public void Third(string[] args) { try { decimal A; decimal B; decimal C; Console.WriteLine($"Type the first number: "); A = Convert.ToInt32(Console.ReadLine()); Console.WriteLine($"Now type the second number: "); B = Convert.ToInt32(Console.ReadLine()); C = (A / B); Console.WriteLine($"{A} / {B} equals {C}"); Console.ReadLine(); Main_Menu mMenu = new Main_Menu(); mMenu.Menu(args); } catch (Exception Ex) { Console.WriteLine($"Please input a number and do not divide by 0"); Console.ReadLine(); Main_Menu mMenu = new Main_Menu(); mMenu.Menu(args); } }
public void First(string[] args) { try { int A; int B; int C; Console.WriteLine($"Type the first number: "); A = Convert.ToInt32(Console.ReadLine()); Console.WriteLine($"Now type the second number: "); B = Convert.ToInt32(Console.ReadLine()); C = (A + B); Console.WriteLine($"{A} + {B} equals {C}"); Console.ReadLine(); Main_Menu mMenu = new Main_Menu(); mMenu.Menu(args); } catch (FormatException fEx) { Console.WriteLine($"Please input a number"); Console.ReadLine(); Main_Menu mMenu = new Main_Menu(); mMenu.Menu(args); } }
static void Main(string[] args) { { Main_Menu mMenu = new Main_Menu(); mMenu.Menu(args); } }
public void Menu(string[] args) { Console.Clear(); Exiting Ex = new Exiting(); Main_Menu mMenu = new Main_Menu(); Addition add = new Addition(); Subtraction sub = new Subtraction(); Division div = new Division(); Multiplication mult = new Multiplication(); Console.WriteLine($"What would you like to do"); Console.WriteLine($"Select (1) for addition"); Console.WriteLine($"Select (2) for subtraction"); Console.WriteLine($"Select (3) for division"); Console.WriteLine($"Select (4) for multiplication"); Console.WriteLine($"Or select (5) to exit the program"); string userSwitch = "0"; userSwitch = Console.ReadLine(); switch (userSwitch) { case "1": add.First(args); break; case "2": sub.Second(args); break; case "3": div.Third(args); break; case "4": mult.Fourth(args); break; case "5": Console.WriteLine($"Thank you for stopping by"); Console.ReadLine(); break; } }