public void RunSimulator() { bool displayField = false; UserLib.OutputHeading(" Foxes and Rabbits Sumulation"); int lastStep = (int)UserLib.InputNumber("Run the simulation how many times > "); Console.WriteLine(); Console.Write(" Do you want to display the field (Y/N) >"); string answer = Console.ReadLine(); if (answer.ToLower() == "y") { displayField = true; } for (int step = 1; step <= lastStep; step++) { simulator.SimulateOneStep(); if (displayField) { Console.WriteLine(simulator.Field.ToString()); } CountAnimals(); string result = stats.GetPopulationDetails(simulator.Field); Console.WriteLine(result); } }
///<summary> /// Prompt the user to select Imperial or Metric /// units. Input the user's height and weight and /// then calculate their BMI value. Output which /// weight category they fall into. ///</summary> public void CalculateIndex() { UserLib.OutputHeading("\tBMI Calculator"); UnitSystem unitSystem = SelectUnits(); if (unitSystem == UnitSystem.Metric) { InputMetricDetails(); CalculateMetricBMI(); } else { InputImperialDetails(); CalculateImperialBMI(); } OutputHealthMessage(); }
///<summary> /// Prompt the user to select Imperial or Metric /// units. Input the user's height and weight and /// then calculate their BMI value. Output which /// weight category they fall into. ///</summary> public void CalculateIndex() { UserLib.OutputHeading("\tBMI Calculator"); UnitSystem unitSystem = SelectUnits(); if (unitSystem == UnitSystem.Metric) { InputMetricDetails(); index = kilograms / (metres * metres); } else { InputImperialDetails(); index = pounds * 703 / (inches * inches); } OutputHealthMessage(); }
public void OutputMenu() { string[] choices = { "Input Marks", "Output Marks", "Output Stats", "Output Grade Profile", "Quit" }; int choiceNo; do { UserLib.OutputHeading(" Students Grades App"); choiceNo = UserLib.SelectChoice(choices); switch (choiceNo) { case 1: InputMarks(); break; case 2: OutputMarks(); break; case 3: CalculateStats(); OutputStats(); break; case 4: CalculateGradeProfile(); OutputGradeProfile(); break; default: break; } } while (choiceNo != 5); }