Untitled
unknown
plain_text
2 years ago
962 B
6
Indexable
using System.Collections.Generic; namespace CleanCodeUppgift1 { public class Controller { private List<string> errorList = new List<string> { "-", "+", "*", "/", "q", "c" }; private double number; private IUI ui = new ConsoleIO(); public double CheckValidDoubleInput(double input) { while (!double.TryParse(ui.ReadInput(), out number)) { ui.WriteOutput("You need to write a valid double."); } return number; } public string CheckValidLetterInput() { string input = ui.ReadInput().ToString(); while (input.Length != 1 || errorList.Contains(input)) { ui.WriteOutput("You need to write a single letter or an arithmetic symbol."); input = ui.ReadInput().ToString(); } return input; } } }
Editor is loading...