示例#1
0
        public static GSM[] CreateArray()
        {
            GSM[] array = new GSM[5];
            Battery[] batteries = new Battery[5];
            Display[] displays = new Display[5];

            //Batteries
            batteries[0] = new Battery("Unknown", 0, 0, BatteryType.LiIon);
            batteries[1] = new Battery("GalaxyS Battery", 200, 30, BatteryType.LiIon);
            batteries[2] = new Battery("Lumia Battery", 200, 30, BatteryType.LiIon);
            batteries[3] = new Battery("Dell", 200, 30, BatteryType.LiIon);
            batteries[4] = new Battery("GalaxyS", 30, 3, BatteryType.LiIon);

            //Displays
            displays[0] = new Display(4.0, 65000);
            displays[1] = new Display(4.0, 65000);
            displays[2] = new Display(4.0, 65000);
            displays[3] = new Display(4.0, 65000);
            displays[4] = new Display(4.0, 65000);

            //GSMs
            array[0] = new GSM("Unknown", "Unknown", 300, null, batteries[0], displays[0]);
            array[1] = new GSM("Galaxy S", "Samsung", 500, "Peter", batteries[1], displays[1]);
            array[2] = new GSM("Lumia 920", "Nokia", 500, "Ivan", batteries[2], displays[2]);
            array[3] = new GSM("Dell GSM", "Dell", 300, null, batteries[3], displays[3]);
            array[4] = new GSM("Galaxy S2", "Samsung", 300, "Joro", batteries[4], displays[4]);

            return array;
        }
示例#2
0
文件: GSM.cs 项目: damy90/Telerik-all
 public GSM(string model, string manufacturer, decimal price, string owner, Battery battery, Display display)
 {
     this.Price = price;
     this.Owner = owner;
     this.Battery = battery;
     this.Display = display;
 }
示例#3
0
 public GSM(string model, string manufacturer, string owner, string[] characteristics, Battery battery, Display display)
     : this(model, manufacturer)
 {
     this.Owner = owner;
     this.Characteristics = characteristics;
     this.BatteryCharateristics = battery;
     this.DisplayCharacteristics = display;
 }
示例#4
0
 public Gsm(string model, string manufacturer, decimal price = 0, Person owner = null, Battery battery = null, Display display = null)
     : this(model, manufacturer)
 {
     this.Price = price;
     this.Owner = owner;
     this.Battery = battery;
     this.Display = display;
 }
示例#5
0
 public GSM(string model, string manufacturer, decimal price, Battery battery, Display display)
 {
     this.Model = model;
     this.Manufacturer = manufacturer;
     this.Price = price;
     this.Battery = battery;
     this.Display = display;
     this.callHistory = new List<Call>();
 }
示例#6
0
 public GSM(string modelX, string manufX, double priceX, string ownerX, Battery gsmBattery, Display gsmDisplay)
 {
     Model = modelX;
     Manufaturer = manufX;
     Price = priceX;
     OwnerName = ownerX;
     GsmBattery = gsmBattery;
     GsmDisplay = gsmDisplay;
 }
示例#7
0
 // complete constructor
 public Gsm(string model, string manufacturer, double? price, string owner, Battery battery, Display display)
 {
     this.Model = model;
     this.Manufacturer = manufacturer;
     this.Price = price;
     this.Owner = owner;
     this.Battery = battery;
     this.Display = display;
 }
 public GSM(string model, string manufacturer, double price, string owner, Battery battery, Display display)
 {
     this.model = model;
     this.manufacturer = manufacturer;
     this.price = price;
     this.owner = owner;
     this.battery = battery;
     this.display = display;
 }
示例#9
0
文件: GSM.cs 项目: stoyans/Telerik
 public GSM(string model = null, string manufacturer = null, int price = 0, string owner = null, Battery battery = null, Display display = null)
 {
     this.Manufacturer = manufacturer;
     this.Model = model;
     this.Price = price;
     this.Owner = owner;
     this.battery = battery;
     this.display = display;
 }
示例#10
0
 public GSM(string model, string manufacturer, decimal? price = null, string owner = null, Battery battery = null, Display display = null)
 {
     this.Model = model;             //this constructor is defined with default arguments which is alternative for making more constructors with diffenerent arguments
     this.Manufacturer = manufacturer; //model and manufacturer are mandatory fields
     this.Price = price;
     this.Owner = owner;
     this.Battery = battery;
     this.Display = display;
     this.CallHistory = new List<Call>();
 }
示例#11
0
 public GSM(string manifacturer, string model, double price, string owner, Battery battery, Display display, List<Call> callHistory)
 {
     this.Manifacturer = manifacturer;
     this.Model = model;
     this.Price = price;
     this.Owner = owner;
     this.Battery = battery;
     this.Display = display;
     this.CallHistory = new List<Call>();
 }
示例#12
0
文件: GSM.cs 项目: K-Pavlov/Telerik
 //Full constructor
 public GSM(string manufacturer, string owner, string model, float? price, Battery battery, Display display)
 {
     this.manufacturer = manufacturer;
     this.owner = owner;
     this.model = model;
     this.price = price;
     this.battery = battery;
     this.display = display;
     callHistory = new List<Call>();
 }
示例#13
0
文件: GSM.cs 项目: studware/Ange-Git
        /// <summary>
        /// constructor with all arguments
        /// </summary>
        public GSM(string model, string manufacturer, decimal price, string owner, Battery gsmBattery, Display gsmDisplay)
        {
            this.Model = model;
            this.Manufacturer = manufacturer;
            this.Price = price;
            this.Owner = owner;
            this.GsmBattery = gsmBattery;
            this.GsmDisplay = gsmDisplay;

            this.CallHistory = new List<Call>();
        }
示例#14
0
        public GSM(string model, string manufacturer, string owner = null,
            decimal? price = null, Display display = null, Battery battery = null)
        {
            this.Model = model;
            this.Manufacturer = manufacturer;
            this.Owner = owner;
            this.Price = price;

            this.Display = display;
            this.Battery = battery;

            this.CallHistory = new CallHistory();
        }
示例#15
0
 public GSM(string model, string manufacturer, decimal? price, string owner,Battery battery,Display display)
 {
     if (price < 0)
     {
         throw new ArgumentException("Invalid price!Price must be positive number");
     }
     this.model = model;
     this.manufacturer = manufacturer;
     this.price = price;
     this.owner = owner;
     this.battery = battery;
     this.display = display;
 }
        /// <summary>
        /// Defines the entry point of the application.
        /// </summary>
        private static void Main()
        {
            Battery nokiaBattery = new Battery("B2", 168.5f, 80.5f, BatteryType.NiMH);
            Display nokiaDisplay = new Display(4.5f, 16700000L);
            CellPhone nokia = new CellPhone("C3", "Nokia", 100m, "Ivan Ivanov", nokiaBattery, nokiaDisplay);
            Console.WriteLine(nokia);

            Display galaxyDisplay = new Display(5.5f, 16700000L);
            CellPhone galaxy = new CellPhone("S3", "Galaxy", display: galaxyDisplay);
            Console.WriteLine(galaxy);

            CellPhone cheapPhone = new CellPhone("cheap", "china phones");
            Console.WriteLine(cheapPhone);

            Console.WriteLine(CellPhone.IPhone4S);
        }
示例#17
0
        public static void Main()
        {
            try
            {
                Display display = new Display(4, 16000000);
                Battery battery = new Battery(620, 8, Battery.BatteryModel.NiMH);
                GSM phone = new GSM("One", "HTC", 850, "Person", battery, display);

                GSMTest test = new GSMTest();
                Console.WriteLine("=============");
                test.GSMTesting();
                Console.WriteLine("=============");

                DateTime time = new DateTime();
                time = DateTime.Now;

                Calls[] call = new Calls[5];

                //making some phone calls
                for (int i = 0; i < 5; i++)
                {
                    time = time.AddDays(i);
                    string phoneNumber = "0888999999";
                    int duration = i + 100;
                    call[i] = new Calls(time, phoneNumber, duration);
                    phone.AddCall(call[i]);
                }

                Console.WriteLine();
                decimal pricePerMinute = 0.37m;

                //display call information
                phone.CallHistory();
                Console.WriteLine("=============");
                phone.TotalPriceOfCalls(pricePerMinute);
                Console.WriteLine("=============");
                phone.FindLongestCall();
                phone.TotalPriceOfCalls(pricePerMinute);
                Console.WriteLine("=============");
                phone.ClearCallHistory();
                phone.CallHistory();
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
        }
示例#18
0
        public string TestMobilePhoneCreation()
        {
            Battery myBattery = new Battery("Some Battery");
            myBattery.HoursIdle = 100;
            myBattery.HoursTalk = 200;
            myBattery.Type = BatteryType.LiPoly;

            Display myDisplay = new Display();
            myDisplay.Colors = 2000;
            myDisplay.Size = 5.0;

            GSM myGSM = new GSM(Manufacturer.SAMSUNG, "Note 3", myBattery, myDisplay);
            myGSM.Owner = "Pesho";
            myGSM.Price = 400.0M;

            return myGSM.ToString();
        }
示例#19
0
 public GSM(string model, string manufacturer, decimal price, string owner, Battery battery, Display display, params Call[] calls)
 {
     this.model = model;
     this.manufacturer = manufacturer;
     this.price = price;
     this.owner = owner;
     this.battery = battery;
     this.display = display;
     if (calls == null)
     {
         this.callHistory = new List<Call>();
     }
     else
     {
         this.callHistory = new List<Call>(calls);
     }
 }
示例#20
0
        static void Main()
        {
            GSM[] test = new GSM[4];

            Display testDisplay = new Display(11, 8);
            Battery testBattery = new Battery(BatteryType.NiCd, 2, 3289);

            test[0] = new GSM("Desire HD", "HTC", "Me");
            test[1] = new GSM("IPhone3", "Apple", "Stefoto", 600);
            test[2] = new GSM("Lumia", "Nokia", "Vel", 700, testBattery);
            test[3] = new GSM("One X", "HTC", "You", 1000, testBattery, testDisplay);

            for (int i = 0; i < test.Length; i++)
            {
                Console.WriteLine(test[i]);
            }
            Console.WriteLine("----IPhone4S----");
            Console.WriteLine(GSM.IPhone4S.Model);
            Console.WriteLine(GSM.IPhone4S.Manufacturer);
        }
示例#21
0
        public static void PrintInfo()
        {
            GSM[] test = new GSM[3];

            Battery batt = new Battery(BatteryType.NiMH, 100, 20);
            Display disp =new Display(10,56000);

            GSM firstPhone = new GSM("Galaxy", "Samsung", 200,"Me",batt,disp);
            GSM secondPhone = new GSM("N95", "Nokia", 800);
            GSM thirdPhone = GSM.IPhone4S;

            test[0] = firstPhone;
            test[1] = secondPhone;
            test[2] = thirdPhone;

            foreach (GSM phone in test)
            {
                Console.WriteLine(phone);
                Console.WriteLine();
            }
        }
示例#22
0
        private static void Main()
        {
            var premiumDisplay = new Display(4.5, ColorDepth._32Bit);
            var mediocreDisplay = new Display(3.5, ColorDepth._16Bit);
            var poorDisplay = new Display(2.5, ColorDepth._8bit);
            var premiumBattery = new Battery("Sanyo-SN532e", 120, 20, BatteryTypes.LiPol);
            var mediocreBattery = new Battery("Shanzungmang-2341", 80, 15, BatteryTypes.LiIon);
            var poorBattery = new Battery("Mistucura-1224fe", 40, 5, BatteryTypes.NiMh);

            var gsmArray = new GSM[4];
            gsmArray[0] = new GSM("LG-G6", "LG", 600, "Typcho", poorBattery, mediocreDisplay);
            gsmArray[1] = new GSM("Hwawei - G6", "Hwawei", 600.5, "Nikola", mediocreBattery, premiumDisplay);
            gsmArray[2] = new GSM("Nokia", "Lumia920", 500.50, "Gosho", premiumBattery, mediocreDisplay);
            gsmArray[3] = new GSM("Samsung-S4", "Samsung", 800, "Pena", premiumBattery, mediocreDisplay);
            foreach (var item in gsmArray)
            {
                Console.WriteLine(item);
                Console.WriteLine("New GSM");
            }
            Console.WriteLine(GSM.Iphone4S);

            GSMCallHistoryTest.TestHistory();
        }
示例#23
0
        static void Main(string[] args)            //task 7, uncomment to test, or comment in order to use GSMCallHistoryTest
        {
            Battery newBattery = new Battery("VPower", 66, 12, BatteryType.NiMH);
            Display newDisplay = new Display(4.7, 13000000);


            //Initialize without battery and display
            GSM myPhone = new GSM("Nokia", "Lumia 8", "Jack", 699.89);
            Console.WriteLine(myPhone);

            //Initialize with battery and display
            GSM mySecondPhone = new GSM("Nokia", "Lumia 8", "Jack", 699.89, newBattery, newDisplay);
            Console.WriteLine(mySecondPhone);

            //Initialize with manufacturer and model only
            GSM myThirdPhone = new GSM("Sony", "Xperia 10");
            Console.WriteLine(myThirdPhone);

            //Initialize IPhone 4s:
            GSM iphone = new GSM("Apple", "Iphone");
            Console.WriteLine(iphone.IPhone4s);


        }
示例#24
0
 public GSM(Display display)
 {
     this.Display = display;
 }
示例#25
0
 public GSM(string phoneModel, string manufacturer, int phonePrice, string phoneOwner, Battery battery, Display display)
     : this(phoneModel, manufacturer, battery, display)
 {
     this.phonePrice = phonePrice;
     this.phoneOwner = phoneOwner;
 }
示例#26
0
 public GSM(string phoneModel, string manufacturer, Battery battery, Display display)
     : this(phoneModel, manufacturer)
 {
     this.battery = battery;
     this.display = display;
 }
示例#27
0
 public GSM(string model, string manufacturer, decimal price, string owner, Battery battery, Display display)
     : this(model, manufacturer, price, owner)
 {
     this.Battery = battery;
     this.Display = display;
 }
 public GSM(string model, string manufacturer, decimal price, string owner, Battery battery, Display display)
     : this(model, manufacturer, price, owner, battery)
 {
     this.Display = display;
     this.callHistory = new List<Call>();
 }
示例#29
0
 public GSM(string model, string manufacturer, float price, string owner, Battery battery, Display display)
 {
     this.Model        = model;
     this.Manufacturer = manufacturer;
     this.Price        = price;
     this.Owner        = owner;
     this.Battery      = battery;
     this.Display      = display;
 }
示例#30
0
 public GSM(string model, string manufacturer, Battery bat, Display dis, double? price = null, string owner = null)
 {
     this.Model = model;
     this.Manufacturer = manufacturer;
     this.Price = price;
     this.Owner = owner;
     this.Battery = bat;
     this.Display = dis;
 }
示例#31
0
 public GSM(Manufacturer manufacturer, string model, Battery battery, Display display, string owner, decimal price)
     : this(manufacturer, model, battery, display)
 {
     this.Owner = owner;
     this.Price = price;
 }
示例#32
0
 public GSM(Manufacturer manufacturer, string model, Battery battery, Display display)
     : this(manufacturer, model)
 {
     this.Battery = battery;
     this.Display = display;
 }