Пример #1
0
        static void Main(string[] args)
        {
            GSM testPhone = new GSM("Sony Experia", "Sony");

            testPhone.AddCall("0883456789", 3);
            testPhone.AddCall("0889454322", 2);
            testPhone.AddCall("0888344384", 8);

            testPhone.GetCalls();
            Console.WriteLine("The total price of the calls in the history is:");
            Console.WriteLine(testPhone.CalculatePrice(0.37m));
            testPhone.RemoveLongestCall();
            Console.WriteLine("The total price of these calls:");
            testPhone.GetCalls();
            Console.WriteLine("is:");
            Console.WriteLine(testPhone.CalculatePrice(0.37m));
            testPhone.ClearCalls();
            Console.WriteLine("After clear history there are calls:" );
            testPhone.GetCalls();
        }
Пример #2
0
 static void Main()
 {
     Console.WriteLine("Enter the size of the array:");
     int size = int.Parse(Console.ReadLine());
     GSM[] testArr = new GSM[size];
     for (int i = 0; i < size; i++)
     {
         Console.WriteLine("Enter manufacturer:");
         string manufacturer = Console.ReadLine();
         Console.WriteLine("Enter model");
         string model = Console.ReadLine();
         Console.WriteLine("Enter price:");
         decimal price = decimal.Parse(Console.ReadLine());
         Console.WriteLine("Enter owner:");
         string owner = Console.ReadLine();
         testArr[i] = new GSM(manufacturer, model, price, owner);
         Console.WriteLine(testArr[i]);
         Console.WriteLine();
     }
     Console.WriteLine(GSM.IPhone4S);
 }