示例#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 manifacturer, decimal price, string owner, Battery battery, Display display)
     : this(manifacturer, model)
 {
     this.Price = price;
     this.Owner = owner;
     this.Battery = battery;
     this.Display = display;
 }
示例#3
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;
 }
示例#4
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;
 }
示例#5
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;
 }
示例#6
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;
 }
示例#7
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>();
 }
示例#8
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);
        }
示例#9
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;
 }
示例#10
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;
 }
示例#11
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;
        }
示例#12
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;
 }
        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();
        }
示例#14
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;
 }
        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>();
        }