コード例 #1
0
ファイル: GSM.cs プロジェクト: DanteSparda/TelerikAcademy
        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();
        }
コード例 #2
0
 static void Main(string[] args)
 {
     GSM[] phones = {
                        new GSM("Nexus", "Samsung",350,null,new Battery("Lion",8,4,BatteryType.NiMH),new Display(5,40000000)),
                        new GSM("G3","LG"),
                        new GSM("Iphone4","Apple")
                    };
     foreach (var phone in phones)
     {
         Console.WriteLine(phone);
     }
     Console.WriteLine(GSM.iPhone4S);
     GSMCallHistoryTest a = new GSMCallHistoryTest();
     a.CallHistoryTest();
 }
コード例 #3
0
        static void Main(string[] args)
        {
            GSM[] phones =
            {
                new GSM("Nexus",   "Samsung", 350, null, new Battery("Lion", 8, 4, BatteryType.NiMH), new Display(5, 40000000)),
                new GSM("G3",      "LG"),
                new GSM("Iphone4", "Apple")
            };
            foreach (var phone in phones)
            {
                Console.WriteLine(phone);
            }
            Console.WriteLine(GSM.iPhone4S);
            GSMCallHistoryTest a = new GSMCallHistoryTest();

            a.CallHistoryTest();
        }
コード例 #4
0
        static void Main()
        {
            var phones = new List <GSM>();

            var peshoPhone = new GSM("3310", "Nokia", 50, "Pesho");
            var goshoPhone = new GSM("Galaxy S6", "Samsung", 200, "Gosho");
            var toshoPhone = new GSM("p9", "Huawei", 250, "Tosho");

            GSM.IPhone4S = new GSM("s6", "Apple", 300, "Ivan");
            phones.Add(peshoPhone);
            phones.Add(goshoPhone);
            phones.Add(toshoPhone);
            phones.Add(GSM.IPhone4S);
            foreach (var phone in phones)
            {
                Console.WriteLine(phone.ToString());
            }

            GSMCallHistoryTest test = new GSMCallHistoryTest();
        }
コード例 #5
0
        static void Main()
        {
            Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;

            Battery myBattery = new Battery("Bateria");
            Display myDisplay = new Display();
            GSM myGSM = new GSM("Nokia","Nokia", 100.23M, "Pesho",myBattery,myDisplay);
            string myGSMinfo = myGSM.ToString();
            Console.WriteLine(myGSMinfo);

            GSM mySecondGSM = GSM.IPhone4S;

            Console.WriteLine(mySecondGSM);

            GSMTest test = new GSMTest();
            test.Create4GSMs();

            GSMCallHistoryTest secondTest = new GSMCallHistoryTest();
            secondTest.CallHistoryTest();
        }
コード例 #6
0
        public static void Test()
        {
            GSM phone = new GSM("Samsung", "Galaxy S3");

            //Add calls
            GSMCallHistoryTest.Calls = new List <Calls>
            {
                new Calls(new DateTime(2015, 03, 17, 10, 32, 23), "0887591529", 35),
                new Calls(new DateTime(2015, 03, 17, 11, 32, 23), "0887595629", 56),
                new Calls(new DateTime(2015, 03, 17, 13, 32, 23), "0887576529", 39)
            };
            foreach (Calls call in GSMCallHistoryTest.Calls)
            {
                phone.AddCall(call);
            }

            GSMCallHistoryTest.PrintInfoCalls(GSM.CallHistory);

            Console.WriteLine("Total price is {0:F2}", GSM.CalculateTotalPrice(0.37));
            RemoveLongestCall(phone, GSM.CallHistory);
            Console.WriteLine("Total price without the longest call is {0:F2}", GSM.CalculateTotalPrice(0.37));
            phone.ClearCallHistory();
        }
コード例 #7
0
 static void Main()
 {
     GSMTest.GSM_Test();
     GSMCallHistoryTest.CallHistoryTest();
 }
コード例 #8
0
 static void Main()
 {
     GSMTest.Test();
     Console.WriteLine();
     GSMCallHistoryTest.Test();
 }
コード例 #9
0
ファイル: StartUp.cs プロジェクト: molivpopov/Telerik
 public static void Main()
 {
     GSMTest.Test();
     GSMCallHistoryTest.Test();
 }
コード例 #10
0
ファイル: MainClass.cs プロジェクト: anedelcheva/CSharp
        static void Main(string[] args)
        {
            GSMCallHistoryTest test = new GSMCallHistoryTest();

            test.testMethods();
        }