Ejemplo n.º 1
0
        public void Start()
        {
            //loop for displaying always the menu
            int choiceSwitch = -1;

            while (choiceSwitch != 0)
            {
                //show the Menu by calling its method
                WriteMenuText();
                //read input from the user and match it with switch cases
                choiceSwitch = Input.ReadIntegerConsole();

                /*depending on the value of the choice, create an instance of
                 * the class displayed on the menu
                 */
                switch (choiceSwitch)
                {
                //create whole numbers object if option 1 is chosen
                case 1:
                    WholeNumbersForAdd wholeNumbersForAdd = new WholeNumbersForAdd();
                    wholeNumbersForAdd.Start();
                    break;

                //create floating point object if option 2 is chosen
                case 2:
                    FloatingPointsNumberWhileAdd floatingPointsNumberWhileAdd = new FloatingPointsNumberWhileAdd();
                    floatingPointsNumberWhileAdd.Start();
                    break;

                //create currency converter object if option 3 is chosen
                case 3:
                    CurrencyConverter currencyConverter = new CurrencyConverter();
                    currencyConverter.Start();
                    break;

                // create working schedule object if option 4 is chosen
                case 4:
                    WorkingSchedule workingSchedule = new WorkingSchedule();
                    workingSchedule.Start();
                    break;

                //create temperature object if option 5 is chosen(optional requirement)
                case 5:
                    Temperature temperature = new Temperature();
                    temperature.Start();
                    break;

                //exit the program if option 0 is chosen
                case 0:
                    Environment.Exit(0);
                    break;

                //wait for correct input if the user inserts an inexistent option
                default:
                    Console.WriteLine("Invalid Choice");
                    break;
                }
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Startmethod that starts other methods and takes input from the user.
        /// </summary>
        public void Start()
        {
            int choice = -1;

            while (choice != 0)
            {
                WriteMenuText();

                choice = Input.ReadIntegerConsole();

                switch (choice)
                {
                case 1:
                {
                    WholeNumbersForAdd sumObj = new WholeNumbersForAdd();
                    sumObj.Start();


                    break;
                }

                case 2:
                {
                    FloatingNumbersWhileAdd sumObj = new FloatingNumbersWhileAdd();
                    sumObj.Start();
                    break;
                }

                case 3:
                {
                    CurrencyConverter sumObj = new CurrencyConverter();
                    sumObj.Start();
                    break;
                }

                case 4:
                {
                    WorkingSchedule WorkObj = new WorkingSchedule();
                    WorkObj.Start();
                    break;
                }

                case 5:
                {
                    TemperatureConverter TempObj = new TemperatureConverter();
                    TempObj.Start();
                    break;
                }
                }
            }
        }
Ejemplo n.º 3
0
        private void WriteMenuText()
        {
            while (true) //endless loop
            {
                Console.Write("\t\tMAIN MENU\n\n" +
                              "Whole Numbers with For\t\t\t: 1\n" +
                              "Floating Point Numbers with While\t: 2\n" +
                              "Currency Converter with Do While Loop\t: 3\n" +
                              "Work Schedule\t\t\t\t: 4\n" +
                              "Temperature Table\t\t\t: 5\n" +
                              "Exit the program\t\t\t: 0\n\n" +
                              "Your choice: ");
                switch (Console.ReadLine())
                {
                case "1":
                    var wholeNumbersForAdd = new WholeNumbersForAdd();
                    wholeNumbersForAdd.Start();
                    break;

                case "2":
                    var floatingPointsNumberWhileAdd = new FloatingPointsNumberWhileAdd();
                    floatingPointsNumberWhileAdd.Start();
                    break;

                case "3":
                    var currencyConverter = new CurrencyConverter();
                    currencyConverter.Start();
                    break;

                case "4":
                    var workingSchedule = new WorkingSchedule();
                    workingSchedule.Start();
                    break;

                case "5":
                    var temperatureTable = new TemperatureTable();
                    temperatureTable.Start();
                    break;

                case "0":
                    return;

                default:
                    Console.WriteLine("\nInvalid input, try again\n");
                    break;
                }
            }
        }
Ejemplo n.º 4
0
        ///  <summary>
        /// The Start method in the menu. It loops and keeps requesting input from the user as long as it is not in line with any of the options.
        /// If the choice is 0 the program will end. If 1-4 is input another class will be initiated.
        ///  </summary>
        public void Start()
        {
            int choice = -1;

            while (choice != 0)
            {
                WriteMenuText();

                choice = int.Parse(Console.ReadLine());

                switch (choice)
                {
                case 1:
                {
                    WholeNumbersForAdd sumObj = new WholeNumbersForAdd();

                    sumObj.Start();
                    break;
                }

                case 2:
                {
                    FloatingPointsNumberWhileAdd floatWhile = new FloatingPointsNumberWhileAdd();

                    floatWhile.Start();
                    break;
                }

                case 3:
                {
                    CurrencyConverter currencyConverter = new CurrencyConverter();

                    currencyConverter.Start();
                    break;
                }

                case 4:
                {
                    WorkingSchedule workingSchedule = new WorkingSchedule();

                    workingSchedule.Start();
                    break;
                }
                }
            }
        }
Ejemplo n.º 5
0
        public void Start()
        {
            CostumConsole();
            int choise = -1;

            while (choise != 0)
            {
                WriteMenuText();

                //Read the user input
                choise = Input.ReadIntegerConsole();
                //Depending on the users input, creats an instance of the class displayed on the menu.
                switch (choise)
                {
                case 1:     //Menu item 1
                    WholeNumbersForAdd sumObj = new WholeNumbersForAdd();
                    sumObj.Start();
                    break;

                case 2:     //Menu item 2
                    FloatingPointsNumberWhileAdd sumFload = new FloatingPointsNumberWhileAdd();
                    sumFload.Start();
                    break;

                case 3:     //Menu item 3
                    CurrencyConverter converter = new CurrencyConverter();
                    converter.Start();
                    break;

                case 4:     //Menu item 4
                    WorkingSchedule workingSchedule = new WorkingSchedule();
                    workingSchedule.Start();
                    break;

                case 5:     //Menu item 5
                    Temperatures temperatures = new Temperatures();
                    temperatures.Start();
                    break;
                }
            }
        }