예제 #1
0
        internal void MainMenuCallTest()
        {
            try
            {
                GSM gsm = new GSM();
                int userInput;

                do
                {
                    userInput = DisplayMenu();
                    Console.Clear();
                    switch (userInput)
                    {
                    case 1:
                        gsm.AddingCalls();
                        break;

                    case 2:
                        gsm.DeletingCalls();
                        break;

                    case 3:
                        gsm.ListCalls();
                        break;

                    case 4:
                        gsm.ClearCallHistory();
                        break;

                    case 5:
                        gsm.CalculatePriceCalls();
                        break;

                    default:
                        break;
                    }
                    if (userInput > 6)
                    {
                        Console.WriteLine("Wrong input, you can only chose between number 1 or 2, no other inputs allowed");
                        Console.WriteLine("Press enter to try again");
                        Console.ReadLine();
                        MainMenuCallTest();
                    }
                } while (userInput != 6);
            }
            catch (FormatException)
            {
                Console.Clear();
                Console.WriteLine("Wrong input, you can only chose between the numbers 1-6, no other inputs allowed");
                Console.WriteLine("Press enter to try again");
                Console.ReadLine();
                MainMenuCallTest();
            }
        }
예제 #2
0
        internal static void Telephones()
        {
            telephones[0] = new GSM("3310", "Nokia", 300, "Gertrud Nilsson", new Battery(Battery.BatteryType.Li_lon, "85KLI", 10.5, 2.5), new Display("170X40", 1000));
            telephones[1] = new GSM("3330", "Nokia", 350, "Agda Persson", new Battery(Battery.BatteryType.NiCd, "UIR25", 11.3, 3.1), new Display("170X40", 1000));
            telephones[2] = new GSM("Galaxy A42", "Samsung", 12000, "Anton Friberg", new Battery(Battery.BatteryType.NiCd, "GAL42i", 34, 21), new Display("720X1600 HD+", 1000));


            Console.WriteLine(telephones[0].DisplayAllInfo());
            Console.WriteLine(telephones[1].DisplayAllInfo());
            Console.WriteLine(telephones[2].DisplayAllInfo());
            Console.WriteLine(GSM.Iphone4S.DisplayAllInfo());

            Console.WriteLine("\nPress enter for main menu");

            Console.ReadLine();
        }