Ejemplo n.º 1
0
        public void DisplayCallGsm()
        {
            Gsm gsm = new Gsm("Galaxy S7 edge", "Samsung", 799.99m, "Vali Koleva", new Battery("S-25", 21, 58, BatteryType.LiIon), new Display(5.6, 25));

            gsm.AddCall(new Call(DateTime.Now, "081255555", 253));
            gsm.AddCall(new Call(DateTime.Now, "457122", 12));
            gsm.AddCall(new Call(DateTime.Now, "78116", 10));
            Console.WriteLine(gsm.ToString());
            Console.WriteLine("Total price {0:f2} lv.", gsm.CalculatePrice(0.37m));
            Console.WriteLine("-----------------------------------------------");

            int maxDur = int.MinValue;
            int index  = 0;

            for (int i = 0; i < gsm.CallHistory.Count; i++)
            {
                if (gsm.CallHistory[i].Duration > maxDur)
                {
                    maxDur = gsm.CallHistory[i].Duration;
                    index  = i;
                }
            }

            gsm.DeleteCall(gsm.CallHistory[index]);
            Console.WriteLine(gsm.ToString());
            Console.WriteLine("Total price {0:f2} lv.", gsm.CalculatePrice(0.37m));
            Console.WriteLine("---------------------------------------------------");

            gsm.ClearCallHistory();
            Console.WriteLine(gsm.ToString());
        }
Ejemplo n.º 2
0
        public void Display()
        {
            Gsm[] gsms = new Gsm[]
            {
                new Gsm("Xperia XZ", "Sony", 1099.99m, "Stoyan Kolev", new Battery("HG-25", 25, 53, BatteryType.LiIon), new Display(5.2, 14)),
                new Gsm("K6", "Lenovo", 119.00m, "Nino Sashev", new Battery("ML-K", 48, 53, BatteryType.NiCd), new Display(4.5, 21)),
                new Gsm("Galaxy S7", "Samsung", 719.00m, "Sergej Vil", new Battery("LJ-12", 20, 32, BatteryType.NiMH), new Display(5, 10)),
                new Gsm("P9 Lite", "Huawei")
            };

            foreach (var gsm in gsms)
            {
                Console.WriteLine(gsm.ToString());
                Console.WriteLine();
            }

            Console.WriteLine(Gsm.IPhoneFourS);
        }
Ejemplo n.º 3
0
 static Gsm()
 {
     iPhoneFourS = new Gsm("IPhone4S", "Apple", 1020.00m, "Tina Moleva", new Battery("SD-L", 50, 32, BatteryType.LiIon), new Display(5, 23));
 }