Пример #1
0
 public GSM(string manufacturer, string model, Battery battery, Display display, string owner, int price)
     : this(manufacturer, model, battery)
 {
     this.Display = display;
     this.Owner = owner;
     this.Price = price;
 }
Пример #2
0
 public GSM(string model, string manufacturer, decimal price, string owner, Battery battery)
     : this(model, manufacturer)
 {
     this.Price = price;
     this.Owner = owner;
     this.Battery = battery;
 }
Пример #3
0
        static void Main()
        {
            GSM gg = new GSM("sony", "az");

            Battery bat = new Battery();

            bat.BatteryType =
        }
Пример #4
0
 public GSM(string model, string manifacturer, decimal price, string owner, Battery battery, Display display)
     : this(manifacturer, model)
 {
     this.Price = price;
     this.Owner = owner;
     this.Battery = battery;
     this.Display = display;
 }
Пример #5
0
 public GSM(string model, string manufacturer, decimal price, string owner, Battery gsmBattery, Display gsmDisplay)
     : this(model, manufacturer)
 {
     this.Price = price;
     this.Owner = owner;
     this.GsmBattery = gsmBattery;
     this.GsmDisplay = gsmDisplay;
     this.CallHistory = new List<Call>();
 }
Пример #6
0
 public GSM(string model, string manufact, double? price=null, string owner=null, Battery battery=null, Display display=null)
 {
     this.model = model;
     this.manufacturer = manufact;
     this.price = price;
     this.owner = owner;
     this.battery = battery;
     this.Display = display;
 }
Пример #7
0
 public GSMobile(string model, string manufacturer, string owner)
 {
     this.Model = model;
     this.Manufacturer = manufacturer;
     this.price = null;
     this.Owner = owner;
     this.batery = null;
     this.display = null;
 }
Пример #8
0
 public GSMAll(string model, string manufacturer, string owner , decimal price , Display display , Battery battery)
 {
     this.model = model;
     this.manufacturer = manufacturer;
     this.owner = owner;
     this.price = price;
     this.display = display;
     this.battery = battery;
 }
Пример #9
0
 public GSMobile(string model, string manufacturer, decimal price, string owner, Battery battery, Display display)
 {
     this.Model = model;
     this.Manufacturer = manufacturer;
     this.Price = price;
     this.Owner = owner;
     this.batery = battery;
     this.display = display;
 }
Пример #10
0
        public static void TestGSM()
        {
            var battery = new Battery("Moqta firma za baterii", "Moqt model bateriq", 100, 150, BatteryType.LiIon);
            var display = new Display("Moqta firma za displejove", "Moqt model display", 5.6, "1900 x 600");
            var gsm = new GSM("Moqta firma", "Moqt model", battery, display, "Az sym owner", 1900);

            var gsmToString = gsm.ToString();
            Console.WriteLine(gsmToString);
        }
Пример #11
0
 //Task 2 - Full constructor with all parameters
 public GSM(string model, string manufacturer, decimal price, string owner, Battery battery, Display display, List<Call> callHistory)
 {
     this.model = model;
     this.manufacturer = manufacturer;
     this.price = price;
     this.owner = owner;
     this.battery = battery;
     this.display = display;
     this.callHistory = callHistory;
 }
Пример #12
0
 public GSM(string manufacturer, string model, decimal price, string owner, Battery batteryCharacteristics, Display displayCharacteristics)
 {
     this.Manufacturer = manufacturer;
     this.Model = model;
     this.Price = price;
     this.Owner = owner;
     this.batteryCharacteristics = batteryCharacteristics;
     this.displayCharacteristics = displayCharacteristics;
     this.CallHistory = callHistory;
 }
Пример #13
0
        public GSM(string model, string manufacturer, decimal? price, string owner, string displaySize,
            uint? displayNumOfColors, string batteryModel, Type batteryType, uint? batteryHoursIdle, uint? batteryHoursTalk)
        {
            this.display = new Display(displaySize, displayNumOfColors);
            this.battery = new Battery(batteryModel, batteryType, batteryHoursIdle, batteryHoursTalk);

            this.model = model;
            this.manufacturer = manufacturer;
            this.price = price;
            this.owner = owner;
        }
Пример #14
0
 public GSM(
     string model,
     string manufacturer,
     string owner,
     decimal price,
     Battery battery,
     Display display)
     : this(model, manufacturer, owner, price)
 {
     this.Battery = battery;
     this.Display = display;
 }
Пример #15
0
        static void Main()
        {
            Battery myBattery = new Battery("B. M.", 15, 56, BatteryType.NiMH);
            Battery myBattery1 = new Battery("B. M.", 17, 68, BatteryType.LiIon);
            Battery myBattery2 = new Battery("B. M.", 16, 69, BatteryType.NiCd);

            GSM gsm = new GSM("S6", "Samsung", 500.03m, "Pesho", myBattery);
            Console.WriteLine(gsm + "\n");
            Console.WriteLine(GSM.IPhone + "\n");

            GSM gsm1 = new GSM("S1", "Samsung", 100.09m, "Pesho", myBattery);
            GSM gsm2 = new GSM("S2", "Samsung", 200.09m, "Pesho", myBattery1);
            GSM gsm3 = new GSM("S3", "Samsung", 300.09m, "Pesho", myBattery2);
            GSM gsm4 = new GSM("S4", "Samsung", 400.09m, "Pesho", myBattery1);

            List<GSM> gsmList = new List<GSM>() { gsm1, gsm2, gsm3, gsm4 };

            foreach (var telephone in gsmList)
            {
                Console.WriteLine(telephone);
            }

            DateTime date1 = new DateTime(2008, 8, 29, 19, 27, 15, 18);
            DateTime date2 = new DateTime(2014, 8, 30, 19, 22, 15, 18);
            DateTime date3 = new DateTime(2014, 9, 15, 10, 12, 14, 44);

            CultureInfo ci = CultureInfo.InvariantCulture;

            Call call1 = new Call(date1, date1, "+359878864612", 120);
            Call call2 = new Call(date2, date2, "+359871164612", 820);
            Call call3 = new Call(date3, date3, "+359872264612", 320);

            gsm.AddCall(call1);
            gsm.AddCall(call2);
            gsm.AddCall(call3);

            var calls = gsm.GetCalls();

            gsm.DisplayCallsInfo();

            Console.WriteLine("\nTotal price of the calls in the history is {0} BGN\n", gsm.CallPrice());

            var longestCall = calls.OrderByDescending(x => x.CallDurationInSeconds).First();
            gsm.DeleteCall(longestCall);

            Console.WriteLine("Phone call deleted");
            Console.WriteLine("\nTotal price of the calls in the history is {0} BGN\n", gsm.CallPrice());

            gsm.ClearCallHistory();
            gsm.DisplayCallsInfo();
        }
        static void Main()
        {
            const int TestLenOfArray = 10; //max length of test array
            List<GSM> testGSMArray = new List<GSM>(); // declare test array of instances of the GSM class
            Battery newBattery = new Battery("C6603", 530, 11, BatteryType.LiIon);  // create instance of Battery class
            Display newDisplay = new Display(5, 16000000);        // create instance of Display class

            //initialize testGSMArray
            for (int i = 0; i < TestLenOfArray; i++)
            {
                GSM gsm = new GSM("Xperia Z", "Sony", 680.00m, "Pesho", newBattery, newDisplay);
                testGSMArray.Add(gsm);
            }

            testGSMArray[0].Owner = "Gogo";
            //test throw exception
            //testGSMArray[0].Price = -1000;

            //test throw exception
            //newBattery.HoursTalk = -1;

            //test GSM
            for (int i = 0; i < TestLenOfArray; i++)
            {
                Console.WriteLine("_________________________________________");
                testGSMArray[i].PrintAllInfoGSM();
                Console.WriteLine("_________________________________________");
            }
            GSM newGsm = new GSM("Xperia Z", "Sony", 680.00m, "Tosho", newBattery, newDisplay);
            Console.WriteLine(newGsm.IPhone4S);  //TODO method for printing static property
            //test calls

            Call firstCall = new Call("+359888445522", 300);
            Call secondCall = new Call("+359888445521", 800);
            Call thirdCall = new Call("+359888445523", 700);

            Console.WriteLine("Calls History:");
            testGSMArray[0].AddCallsINHistory(firstCall);
            Console.Write("Price:{0} BGN ", testGSMArray[0].ClacPriceofCalls(firstCall));
            Console.WriteLine(testGSMArray[0].CallHistory[0].ToString());

            testGSMArray[0].AddCallsINHistory(secondCall);
            Console.Write("Price:{0} BGN ", testGSMArray[0].ClacPriceofCalls(secondCall));
            Console.WriteLine(testGSMArray[0].CallHistory[1].ToString());

            testGSMArray[0].AddCallsINHistory(thirdCall);
            Console.Write("Price:{0} BGN ", testGSMArray[0].ClacPriceofCalls(thirdCall));
            Console.WriteLine(testGSMArray[0].CallHistory[2].ToString());

            decimal totalBill = 0.0m;
            for (int i = 0; i < testGSMArray[0].CallHistory.Count; i++)
            {

                totalBill += testGSMArray[0].ClacPriceofCalls(testGSMArray[0].CallHistory[i]);
            }
            Console.WriteLine("Total Bill:{0}", totalBill);

            uint maxDuration = 0;
            string maxDurCallId = String.Empty;

            //TODO method for calc total price
            for (int i = 0; i < testGSMArray[0].CallHistory.Count-1; i++)
            {
                if(testGSMArray[0].CallHistory[i].CallDuration > maxDuration)
                {
                    maxDuration = testGSMArray[0].CallHistory[i].CallDuration;
                    maxDurCallId = testGSMArray[0].CallHistory[i].Id;
                }
            }

            Console.WriteLine("_____________");
            testGSMArray[0].DeleteCallsHistory(maxDurCallId);
            testGSMArray[0].PrintCallHistory();
            totalBill = 0.0m;
            for (int i = 0; i < testGSMArray[0].CallHistory.Count; i++)
            {

                totalBill += testGSMArray[0].ClacPriceofCalls(testGSMArray[0].CallHistory[i]);
            }
            Console.WriteLine("Total bill without longest call:{0}", totalBill);

            Console.WriteLine("_____________");

            testGSMArray[0].ClearCallsHistory();
            testGSMArray[0].PrintCallHistory();
        }
Пример #17
0
 public GSM(string currModel, string currManufacturer, decimal currPrice, string currOwner, Battery currBattery = null, Display currDisplay = null)
     : this(currModel, currManufacturer, currPrice, currOwner)
 {
     this.battery = currBattery;
     this.display = currDisplay;
 }
Пример #18
0
 public override string ToString()
 {
     return($"{Manufacturer} {Model} \n ${Price} \n Owner: {Owner} \n {Battery.ToString()} \n {Display.ToString()} \n");
 }
Пример #19
0
 public GSM(string model, string manufacturer, decimal price, string owner, Battery battery, Display display) : this(model, manufacturer, price, owner, battery)
 {
     Display = display;
 }
Пример #20
0
 public GSM(string model, string manufacturer, decimal price, string owner, Battery battery) : this(model, manufacturer, price, owner)
 {
     Battery = battery;
 }
Пример #21
0
 public GSM(string manufacturer, string model, Battery battery)
     : this(manufacturer, model)
 {
     this.Battery = battery;
 }
        public GSMDevice(string model, string manufacturer, decimal price, string owner, Display display, Battery battery)
            : this(model, manufacturer, price, owner)
        {
            this.Display = display;
            this.Battery = battery;

            //this.callHistory = new List<Call>();
        }
Пример #23
0
 public GSM(string manufacturer, string model, Battery battery)
     : this(manufacturer, model)
 {
     this.Battery = battery;
 }