static void Main()
        {
            GSM nokia = new GSM(null, null);
            nokia.Battery = new Battery("batt87", 35.5, 3);
            nokia.gsmBattery = new Battery("batt87", 35.5, 3);
            nokia.iPhone4s = new GSM("iphone", "apple");
            nokia.PhoneManufacturer = "Nokia Corp.";
            nokia.PhoneModel = "N70";
            nokia.PhoneOwner = "bai ganio";
            nokia.PhonePrice = 1.01m;
            nokia.Call.CallDuration = 410;
            nokia.Call.DialedPhoneNumber = 0888123456;
            GSM.callHistory.Add(nokia.Call); //leave no null characteristics - fill all battery, owner etc.

            GSM htc = new GSM(null, null);
            htc.Battery = new Battery("batt87", 30.5, 3.2);
            htc.gsmBattery = new Battery("batt87", 35.1, 0.3);
            htc.iPhone4s = new GSM("iphone", "apple");
            htc.PhoneManufacturer = "HTC Corp.";
            htc.PhoneModel = "One";
            htc.PhoneOwner = "bash ganio";
            htc.PhonePrice = 1.06m;
            htc.Call.CallDuration = 110;
            htc.Call.DialedPhoneNumber = 0877123456;
            GSM.callHistory.Add(htc.Call);

            GSM sony = new GSM(null, null);
            sony.Battery = new Battery("batt87", 25.5, 1.3);
            sony.gsmBattery = new Battery("batt87", 35.5, 3);
            sony.iPhone4s = new GSM("iphone", "apple");
            sony.PhoneManufacturer = "Sony Corp.";
            sony.PhoneModel = "Something";
            sony.PhoneOwner = "ganio";
            sony.PhonePrice = 1.08m;
            sony.Call.CallDuration = 210;
            sony.Call.DialedPhoneNumber = 0899123456;
            GSM.callHistory.Add(sony.Call);

            GSM samsung = new GSM(null, null);
            samsung.Battery = new Battery("batt817", 15.5, 4.3);
            samsung.gsmBattery = new Battery("batt817", 35.5, 3);
            samsung.iPhone4s = new GSM("iphone", "apple");
            samsung.PhoneManufacturer = "samsung Corp.";
            samsung.PhoneModel = "s520";
            samsung.PhoneOwner = "one more ganio";
            samsung.PhonePrice = 111.00m;
            samsung.Call.CallDuration = 262;
            samsung.Call.DialedPhoneNumber = 0882111111;
            //GSM.callHistory.Add(samsung.Call);
            GSM.AddCallsToHistory(samsung.Call);

            foreach (var call in GSM.CallHistory)
            {
                Console.WriteLine("Log Call duration: {0}", call.CallDuration);
                Console.WriteLine();
            }

            GSM.CalculateTotalCallsCost(GSM.callHistory, 0.27m); //pass current call log and call price pre minute in decimal
        }
Beispiel #2
0
        public static void Main()
        {
            GSM iPhone4SDevice = new GSM(null, null);

            iPhone4SDevice.Battery.HoursStandby = 10.5;
            iPhone4SDevice.Battery.HoursTalk = 3.5;
            iPhone4SDevice.Battery.Model = "IBatt4S";
            iPhone4SDevice.Battery.Type = GSMBatteryTypes.NiCd;

            iPhone4SDevice.PhoneManufacturer = "Apple Corp.";
            iPhone4SDevice.PhoneModel = "iPhone 4 S";
            iPhone4SDevice.PhoneOwner = "Apple fan";
            iPhone4SDevice.PhonePrice = 2000.50m;
        }
Beispiel #3
0
        static void Main()
        {
            GSM testGSM = new GSM(null,null);

            testGSM.phoneCall.DialedPhoneNumber = 0888123456;
            testGSM.phoneCall.CallDuration = 1500;

            Console.WriteLine("Call information:");
            Console.Write("Today {0}, ", testGSM.phoneCall.Date.ToShortDateString());
            Console.Write(" You make a call at {0} ", testGSM.phoneCall.Time.ToShortTimeString());
            Console.Write(" and talked to {0} ", testGSM.phoneCall.DialedPhoneNumber);
            Console.Write(" {0} seconds.", testGSM.phoneCall.CallDuration);
            Console.WriteLine();
        }
        static void Main()
        {
            GSM nokia = new GSM(null, null);
            nokia.Battery = new Battery("batt87", 35.5, 3);
            nokia.gsmBattery = new Battery("batt87", 35.5, 3);
            nokia.iPhone4s = new GSM("iphone","apple");
            nokia.PhoneManufacturer = "Nokia Corp.";
            nokia.PhoneModel = "N70";
            nokia.PhoneOwner = "bai ganio";
            nokia.PhonePrice = 1.01m;
            nokia.Call.CallDuration = 410;
            nokia.Call.DialedPhoneNumber = 0888123456;
            GSM.callHistory.Add(nokia.Call); //leave no null characteristics - fill all battery, owner etc.

            GSM htc = new GSM(null, null);
            htc.Battery = new Battery("batt87", 30.5, 3.2);
            htc.gsmBattery = new Battery("batt87", 35.1, 0.3);
            htc.iPhone4s = new GSM("iphone", "apple");
            htc.PhoneManufacturer = "HTC Corp.";
            htc.PhoneModel = "One";
            htc.PhoneOwner = "bash ganio";
            htc.PhonePrice = 1.06m;
            htc.Call.CallDuration = 110;
            htc.Call.DialedPhoneNumber = 0877123456;
            GSM.callHistory.Add(htc.Call);

            GSM sony = new GSM(null, null);
            sony.Battery = new Battery("batt87", 25.5, 1.3);
            sony.gsmBattery = new Battery("batt87", 35.5, 3);
            sony.iPhone4s = new GSM("iphone", "apple");
            sony.PhoneManufacturer = "Sony Corp.";
            sony.PhoneModel = "Something";
            sony.PhoneOwner = "ganio";
            sony.PhonePrice = 1.08m;
            sony.Call.CallDuration = 210;
            sony.Call.DialedPhoneNumber = 0899123456;
            GSM.callHistory.Add(sony.Call);

            foreach (var call in GSM.CallHistory)
            {
                Console.WriteLine("Call number: {0}", call.DialedPhoneNumber);
                Console.WriteLine("Call date: {0}", call.Date.ToShortDateString());
                Console.WriteLine("Call time: {0}", call.Time.ToShortTimeString());
                Console.WriteLine("Call duration: {0}",call.CallDuration);
                Console.WriteLine();
            }
        }
Beispiel #5
0
        static void Main(string[] args)
        {
            //adding directly properties
            GSM testGSM = new GSM("s123", "samsung corp");
            Console.WriteLine("GSM model: {0} and manufacturer: {1}", testGSM.PhoneModel, testGSM.PhoneManufacturer);

            //another way
            testGSM.PhoneModel = "a1234";
            testGSM.PhoneManufacturer = "not samsung";

            //add new battery
            Battery bat = new Battery();
            bat.Model = "some123";
            bat.HoursTalk = 1.5;
            bat.HoursStandby = 2;
            //and adding it to the gsm
            testGSM.Battery = bat;
        }
Beispiel #6
0
        static void Main(string[] args)
        {
            //adding directly properties
            GSM testGSM = new GSM("s123", "samsung corp");

            Console.WriteLine("GSM model: {0} and manufacturer: {1}", testGSM.PhoneModel, testGSM.PhoneManufacturer);

            //another way
            testGSM.PhoneModel        = "a1234";
            testGSM.PhoneManufacturer = "not samsung";

            //add new battery
            Battery bat = new Battery();

            bat.Model        = "some123";
            bat.HoursTalk    = 1.5;
            bat.HoursStandby = 2;
            //and adding it to the gsm
            testGSM.Battery = bat;
        }
Beispiel #7
0
        static void Main()
        {
            GSM nokia = new GSM(null, null);
            nokia.Battery = new Battery("batt87", 35.5, 3);
            nokia.gsmBattery = new Battery("batt87", 35.5, 3);
            nokia.iPhone4s = new GSM("iphone", "apple");
            nokia.PhoneManufacturer = "Nokia Corp.";
            nokia.PhoneModel = "N70";
            nokia.PhoneOwner = "bai ganio";
            nokia.PhonePrice = 1.01m;
            nokia.Call.CallDuration = 410;
            nokia.Call.DialedPhoneNumber = 0888123456;
            GSM.callHistory.Add(nokia.Call); //leave no null characteristics - fill all battery, owner etc.

            GSM htc = new GSM(null, null);
            htc.Battery = new Battery("batt87", 30.5, 3.2);
            htc.gsmBattery = new Battery("batt87", 35.1, 0.3);
            htc.iPhone4s = new GSM("iphone", "apple");
            htc.PhoneManufacturer = "HTC Corp.";
            htc.PhoneModel = "One";
            htc.PhoneOwner = "bash ganio";
            htc.PhonePrice = 1.06m;
            htc.Call.CallDuration = 110;
            htc.Call.DialedPhoneNumber = 0877123456;
            GSM.callHistory.Add(htc.Call);

            GSM sony = new GSM(null, null);
            sony.Battery = new Battery("batt87", 25.5, 1.3);
            sony.gsmBattery = new Battery("batt87", 35.5, 3);
            sony.iPhone4s = new GSM("iphone", "apple");
            sony.PhoneManufacturer = "Sony Corp.";
            sony.PhoneModel = "Something";
            sony.PhoneOwner = "ganio";
            sony.PhonePrice = 1.08m;
            sony.Call.CallDuration = 210;
            sony.Call.DialedPhoneNumber = 0899123456;
            GSM.callHistory.Add(sony.Call);

            //show current call log
            Console.WriteLine("Current call log:");
            Console.WriteLine();
            PringCallsLog(GSM.CallHistory);
            Console.WriteLine("*********");

            //add call to log
            GSM samsung = new GSM(null,null);
            samsung.Battery = new Battery("batt817", 15.5, 4.3);
            samsung.gsmBattery = new Battery("batt817", 35.5, 3);
            samsung.iPhone4s = new GSM("iphone", "apple");
            samsung.PhoneManufacturer = "samsung Corp.";
            samsung.PhoneModel = "s520";
            samsung.PhoneOwner = "one more ganio";
            samsung.PhonePrice = 111.00m;
            samsung.Call.CallDuration = 262;
            samsung.Call.DialedPhoneNumber = 0882111111;
            //GSM.callHistory.Add(samsung.Call);
            GSM.AddCallsToHistory(samsung.Call);

            Console.WriteLine("Call log after adding: ");
            Console.WriteLine();
            PringCallsLog(GSM.CallHistory);
            Console.WriteLine("*********");

            GSM.RemoveCallsFromHistory(samsung.Call);
            Console.WriteLine("Call log after remove a call: ");
            Console.WriteLine();
            PringCallsLog(GSM.CallHistory);
            Console.WriteLine("*********");

            Console.WriteLine("Call log is cleared: ");
            Console.WriteLine();
            GSM.ClearCallsHistory();
            Console.WriteLine("*********");
        }