C++ language
Lab 4 - Simple Calculator Using an if or switch statement Using a while loop e In this lab you will code a simple calculator. It need not be anything overly fancy, but it is up to you to take it as far as you want. You will be creating this program in three small sections. You have the menu, the performance of the basic arithmetic operations (Addition, Subtraction, Multiplication, and Division), and the looping. You may want to get the switch menu working first, and then fill in the code for these four arithmetic operations. Your program will keep a running total. It should print the subtotal out after each and every calculation. In addition, the total should be printed before the program quits. So with that being said, the program needs to define a data field, named total at the beginning of main and set it to zero. Part A: Designing the menu system Menu systems in C++(and other languages) are often represented as a switch statement. Design a switch statement that handles five cae and a default case e case 0 Exit . case 1- Addition . case 2- Subtraction case 3-Multiplication case 4-Division default- Error message e Make sure to print out a list of options explaining to the user what each case does, like Enter 1 to add a number to total" or "Enter 2 to subtract a number from total". This menu should appear before the switch statements. is also vital to allow the user to input their choice of 0-4 Part B: Filling in the Cases At this point, you should have a working menu that does nothing. It is time to add code to each of the cases so that they will do the function you displayed to the user. Start by writing code inside of case 1 that will prompt the user to enter a single number. Since this case is for addition, you will want to make sure to add the number you entered to the running total. Once this works, you should do the same for the other mathematical functions. Only substituting in the other three operation (Subtraction, Multiplication, and Division) Part C: Repetition Allowing the user to select which function then input data is nice. But how often do you open the calculator and do just a single calculation? It would be a good idea to wrap your entire menu into some sort of structure that allows it to repeat more than a single time. If you were to use such a thing, how would you stop it? Part C is to surround your entire program thus far with a loop that allows it to be run more than once. It would also be a good idea to allow for exiting this loop. Be sure to print out a sub total each time the loop runs. Run: You will do two runs of this program. Run One: Add 10, multiply by 5.5, divide by 3, add 20.5, subtract 5 and exit. The final total should be 33.83. Run Two: Enter in numbers of your choosing. Please choose at least 1 addition, 1 subtraction, 1 multiplication, and 1 division. Remember to double check your