Esempio n. 1
0
        private static void Main()
        {
            // Inserting data:
            GSM myPhone = new GSM("Nokia", "Nokia OOD");

            myPhone.Price                  = 500;
            myPhone.Owner                  = "Ivancho";
            myPhone.battery                = new Battery(BatteryType.NiMH);
            myPhone.battery.HourIdle       = 12;
            myPhone.battery.HoursTalk      = 520;
            myPhone.display                = new Display(12);
            myPhone.display.NumberOfColors = 326;

            // Transfering data and printing
            Console.WriteLine(myPhone.PrintMobileInfo(myPhone.battery, myPhone.display));

            // Iphone4S data:
            string theIPhoneInfo = GSM.IPhone4S;

            Console.WriteLine(theIPhoneInfo);

            // and ETC
            GSM phone = new GSM("Alcatel", "Alacatelov");

            GSMTest.CreateAFewGSMs(5);

            // Adding calls
            myPhone.resentCall = new Call("0898123231");
            Console.WriteLine(myPhone.resentCall.LastNumber);
            myPhone.CallHistory.Add(myPhone.resentCall);

            // Adding a second call
            myPhone.resentCall = new Call("08788765426");

            // Adding the call to the list
            myPhone.CallHistory.Add(myPhone.resentCall);
            foreach (Call talk in myPhone.CallHistory)
            {
                Console.WriteLine(talk.LastNumber);
            }

            // From here on, the adding to the callHistory is automatic
            myPhone.AddAndRemove("add", myPhone);
            myPhone.AddAndRemove("remove", myPhone);
            double totalPrice = myPhone.TotalPriceOfCalls(myPhone);

            // Not working because I don't have thread.sleep or something to make timespan
            Console.WriteLine("Total price: {0}", totalPrice);

            // Clearing the history
            myPhone.ClearHistory();
            GSMCallHistoryTest.GSMTest();
        }
Esempio n. 2
0
        private static void Main()
        {
            // Inserting data:
            GSM myPhone = new GSM("Nokia", "Nokia OOD");
            myPhone.Price = 500;
            myPhone.Owner = "Ivancho";
            myPhone.battery = new Battery(BatteryType.NiMH);
            myPhone.battery.HourIdle = 12;
            myPhone.battery.HoursTalk = 520;
            myPhone.display = new Display(12);
            myPhone.display.NumberOfColors = 326;

            // Transfering data and printing
            Console.WriteLine(myPhone.PrintMobileInfo(myPhone.battery, myPhone.display));

            // Iphone4S data:
            string theIPhoneInfo = GSM.IPhone4S;
            Console.WriteLine(theIPhoneInfo);

            // and ETC
            GSM phone = new GSM("Alcatel", "Alacatelov");
            GSMTest.CreateAFewGSMs(5);

            // Adding calls
            myPhone.resentCall = new Call("0898123231");
            Console.WriteLine(myPhone.resentCall.LastNumber);
            myPhone.CallHistory.Add(myPhone.resentCall);

            // Adding a second call
            myPhone.resentCall = new Call("08788765426");

            // Adding the call to the list
            myPhone.CallHistory.Add(myPhone.resentCall);
            foreach (Call talk in myPhone.CallHistory)
            {
                Console.WriteLine(talk.LastNumber);
            }

            // From here on, the adding to the callHistory is automatic
            myPhone.AddAndRemove("add", myPhone);
            myPhone.AddAndRemove("remove", myPhone);
            double totalPrice = myPhone.TotalPriceOfCalls(myPhone);

            // Not working because I don't have thread.sleep or something to make timespan
            Console.WriteLine("Total price: {0}", totalPrice);

            // Clearing the history
            myPhone.ClearHistory();
            GSMCallHistoryTest.GSMTest();
        }