Example #1
0
        public flower_care(string fileName, int monthOfToday, int dayOfToday)
        {
            this.fileName     = fileName;
            this.monthOfToday = monthOfToday;
            this.dayOfToday   = dayOfToday;

            StreamReader sr0         = new StreamReader(fileName);
            int          lineCounter = 0;

            while (!sr0.EndOfStream)
            {
                lineCounter++;
            }
            sr0.Close();
            flower[] f = new flower[lineCounter];


            StreamReader sr = new StreamReader(fileName);

            int i = 0;

            while (!sr.EndOfStream)
            {
                string   line      = sr.ReadLine();
                string[] Line      = line.Split(',');
                string   type      = Line[0];
                int      tol       = int.Parse(Line[1]);
                int      waterNeed = int.Parse(Line[2]);
                int      month     = int.Parse(Line[3]);
                int      day       = int.Parse(Line[4]);
                string   sting     = Line[5];
                flower   flower    = new flower(type, tol, waterNeed, month, day, sting);
                f[i] = flower;
                i++;
            }
            sr.Close();
        }//flower_care end
Example #2
0
        }//flower_care end

        public string print(int num)
        {
            flower chosenFlower = f[num];

            return(chosenFlower.print());
        }