Exemple #1
0
        static void Main(string[] args)
        {
            //Creating Object of SuperClass and calling getModel Method
            MobilePhone mobileObj = new MobilePhone("Nokia", "Win8", "Lumia", 500);

            mobileObj.getModel();
            Console.WriteLine(mobileObj.getModel());

            //Creating Object of Sublcass and calling getModel Method
            IPhone iphoneObj = new IPhone("Apple", "iOS", "X", 2200);

            iphoneObj.getModel();
            Console.WriteLine(iphoneObj.getModel());

            Samsung samsungObj = new Samsung("Samsung", "Android", "S8", 1500);

            samsungObj.getModel();
            Console.WriteLine(samsungObj.GetWIFIConnection());
            Console.WriteLine(samsungObj.getModel());

            WindowsPhone windowsphoneObj = new WindowsPhone("Microsoft", "Windows", "L7", 1000);

            windowsphoneObj.getModel();
            Console.WriteLine(windowsphoneObj.getModel());
            Console.ReadLine();
        }
Exemple #2
0
        static void Main()
        {
            MobilePhone krisPhone = new MobilePhone("Apple", "iPhone 6s", 300M, "Kristian", new Battery(BatteryType.Type.Li_Poly, 200, 30), new Display(5.5, 16000000));
            // MobilePhone defaultPhone = MobilePhone.iPhone4sInfo;

            // Console.WriteLine(krisPhone); // print info for kristian's phone
            // Console.WriteLine(defaultPhone); // print static member

            string   vili     = "+359882645890";               // contact
            DateTime endCall  = DateTime.Now.AddMinutes(5);    // you can change this to test: add minutes, add hours
            string   infoCall = krisPhone.Call(vili, endCall); // first call

            // Console.WriteLine(infoCall); // print call information

            endCall  = DateTime.Now.AddMinutes(3);
            infoCall = krisPhone.Call(vili, endCall); // second call

            endCall  = DateTime.Now.AddMinutes(1);
            infoCall = krisPhone.Call(vili, endCall); // third call

            List <string> callHistory = krisPhone.CallHistory;

            krisPhone.DeleteCall(1);  // delete first call
            krisPhone.CleanHistory(); // clean call history from kristian's phone

            // krisPhone.PrintCalls();
            double priceForMinute = 0.37;

            krisPhone.CheckBill(priceForMinute); // print your bill
        }
Exemple #3
0
        static void Main(string[] args)
        {
            MobilePhone mph = new MobilePhone("Galaxy", "Samsung", 465, "Hristiyan Nikolov");

            string brand = "";
            string model = "";
            double price = 0;
            string owner = "";

            Console.Write("Devices count: ");
            int count = int.Parse(Console.ReadLine());

            MobilePhone[] mphTest = new MobilePhone[count];
            int[]         arrTest = { 5, 43, 20 };

            for (int i = 0; i < mphTest.Length; i++)
            {
                Console.Write("Brand: ");
                brand = Console.ReadLine();

                Console.Write("Model: ");
                model = Console.ReadLine();

                Console.Write("Price: ");
                price = double.Parse(Console.ReadLine());

                Console.Write("Owner: ");
                owner = Console.ReadLine();

                mphTest[i] = MobilePhoneTest.CreatePhone(brand, model, price, owner);
            }

            for (int i = 0; i < mphTest.Length; i++)
            {
                Console.WriteLine($"Phone №{i + 1}");
                mphTest[i].PrintInfo();
                Console.WriteLine();
            }


            MobilePhone galaxyS2 = new MobilePhone("Samsung", "Galaxy S II Plus", 439);



            galaxyS2.MakeCall("George", 3, 25);

            galaxyS2.MakeCall("Amanda", 12, 32);

            galaxyS2.ViewCallHistory();

            galaxyS2.GetSum(0.24m);
        }