Beispiel #1
0
        public Television CreateATV()
        {
            Television aTV = new Television("Brand X", 10.0m, 42.0);

            aTV.Print();
            return(aTV); // note that you can do this
            // note that this is NOT what you should do for this exercise! :)
        }
Beispiel #2
0
 public void PrintMyTV(Television theTV)
 {
     if (theTV == null)
     {
         Console.WriteLine("Nothing...");
     }
     if (theTV != null)
     {
         theTV.Print();
     }
 }
Beispiel #3
0
        public void RunExercise()
        {
            Television ax = new Television("Sony", 1000.17m, 10.5);

            //ax.SetBrand("Sony");
            //string brand = ax.GetBrand();
            //ax.SetPrice(1000.17m);
            //decimal price = ax.GetPrice();
            //ax.SetSize(10.5);
            //double size = ax.GetSize();

            ax.Print();
        }
Beispiel #4
0
        public Television CreateATVFromUserInput()
        {
            decimal d;
            double  n;

            Console.WriteLine("Enter Brand: ");
            string s = Console.ReadLine();

            Console.WriteLine("Enter Price: ");
            Decimal.TryParse(Console.ReadLine(), out d);
            Console.WriteLine("Enter Size: ");
            Double.TryParse(Console.ReadLine(), out n);
            Television userTV = new Television();

            userTV.Print(s, d, n);
            return(userTV);
        }
Beispiel #5
0
        public void RunExercise()
        {
            TelevisionHandler tvh      = new TelevisionHandler();
            Television        firstTV  = new Television("Samsung", 2.0m, 10.5);
            Television        secondTV = new Television("Westinghouse", 10.5m, 42);
            //firstTV = tvh.CreateATV();
            //secondTV = tvh.CreateATVFromUserInput();

            Television moreExpensiveTV;

            moreExpensiveTV = tvh.PickMoreExpensiveTV(firstTV, secondTV);

            firstTV.Print();
            secondTV.Print();

            Console.WriteLine("The more expensive TV is: ");
            tvh.PrintMyTV(moreExpensiveTV);
        }