예제 #1
0
파일: Program.cs 프로젝트: CMaC253/PCE_06
        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! :)
        }
예제 #2
0
파일: Program.cs 프로젝트: CMaC253/PCE_06
 public void PrintMyTV(Television theTV)
 {
     if (theTV == null)
     {
         Console.WriteLine("Nothing...");
     }
     if (theTV != null)
     {
         theTV.Print();
     }
 }
예제 #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();
        }
예제 #4
0
파일: Program.cs 프로젝트: CMaC253/PCE_06
        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);
        }
예제 #5
0
파일: Program.cs 프로젝트: CMaC253/PCE_06
        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);
        }