Question: I am trying to create a simple math testing program that allows users to practice addition/subtraction/multiplication. I ran into some problems since want the user
I am trying to create a simple math testing program that allows users to practice addition/subtraction/multiplication. I ran into some problems since want the user to be able to keep practicing until they decide to exit and display number of questions they got correct.

Here is one of the methods

I want it so if they choose to practice adding they will get to practice adding problems until they decide to go back to menu. Also when done practicing overall to show amount of correct answers. I was thinking of using do-while loop but couldnt get it working
optionSelection = menuOptions(); switch (optionSelection) case 1: correctAddition = addition(); break; case 2: correctSubtraction = subtraction(); break; case 3: correctMultiplication = multiplication(); break; default: Console.WriteLine("default"); break; correctAddition = addition(); correctSubtraction = subtraction(); correctMultiplication = multiplication(); Console.WriteLine("Correct Addition {@}. Correct Subtraction {1}." + "Correct Multiplication {2}." ,correctAddition, correctSubtraction, correctMultiplication); 2 references public static int addition() Random generateNumber = new Random(); string avalue; int userAnswer, correctAnswer; int num1 = generateNumber.Next(0, 15); int num2 = generateNumber.Next(0, 15); int correctCounter = 0; correctAnswer = num1 + num2; Console.Write("{0} + {1} = ", num1, num2); avalue = Console.ReadLine(); userAnswer = int.Parse(avalue); if(userAnswer == correctAnswer) ; Console.WriteLine("Correct!"); correctCounter++; else Console.WriteLine("Incorrect"); return correctCounter
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
