public static void BMI()//(string weight, string height, string name) { bool toStop = true; while (toStop) { var user1 = new User(); Console.ForegroundColor = ConsoleColor.DarkBlue; Console.WriteLine("Hi and welcome to BMI calculator.\nPlease provide you info.\nName:"); user1.name = Console.ReadLine(); Console.WriteLine("Height, in cm"); user1.height = BasicOperation.inputNumber1(); Console.WriteLine("Weight, in kg"); user1.weight = BasicOperation.inputNumber1(); user1.bmi = user1.weight / ((user1.height / 100) * (user1.height / 100)); Console.WriteLine("Name {0}\nWeight {1}\nHeight {2}\nBMI {3:N02}\n", user1.name, user1.weight, user1.height, user1.bmi); users.Add(user1); Console.WriteLine("Would you like to calculate BMI for another user?\nType 'y' and ENTER to confirm or any other key to ESC/ return to Menu;"); //ESCape from the app/return to menu; string reply = Console.ReadLine(); if (reply == "y") { continue; } else { toStop = false; } } }
public static void displayMenu() { bool exit = false; while (!exit) { Console.WriteLine("Hello there. Type in operation symbol to calculate,\n\"m\" to multiply matrixes,\n\"b\" to calculate body-mass index(BMI)\n\"h\" to view BMI calculations history\n\"H\" to view mathematical operations history \nor 'q' to exit"); string operation = Console.ReadLine(); if (operation == "q") { Environment.Exit(0); } else if (operation == "+") { var result = new CalculatorSum(); result.Result(); } else if (operation == "-") { var result = new CalculatorSub(); result.Result(); } else if (operation == "*") { var result = new CalculatorMultiply(); result.Result(); } else if (operation == "/") { var result = new CalculatorDivision(); result.Result(); } else if (operation == "m") { MatrixMultiply.matrixMultiply(); } else if (operation == "b") { User.BMI(); } else if (operation == "h") { User.bmiHistory(); } else if (operation == "H") { BasicOperation.operationsHistory(); } } }