Loop the program using a while loop to get the next


Write a program to test for the case of a math equation entered via the keyboard using the SWITCH-CASE operator.

Types of equations to test for: x + y  x / y   x * y and x - y.

The program is to ask for the following:

1. Get the equation from the keyboard. For example entered : 10 + 7 or x + y

2. Test case of the equation. For example is would be: case '+': (Save the variables x and y in and array.)

3. Display the equation of the case inputted from the keyboard and its calculated solution on the computer screen

4. Also include a case for an unknown operator.

5. And perform the unknown mathematical operation entered in another part of the program.

Example: (x + y) * (x * y)

or x + y - (2 * y) + 4

These would have to be treated as a string and broken up into pieces.

You would have to test each character in the equation entered to perform the math.

You would be creating a simple calculator.

Other case routines could be used also for more complex equations.

6. Loop the program using a WHILE LOOP to get the next equation to be tested and repeat the process.

7. You may use a program from the book and modify it for the requirements requested in this assignment.

Written Report:

a. Will contain a listing of the program.

b. Will contain a Screen-Print image(s) of the data displayed on the PC's screen.

c. A printout of the text file saved on the disk file must be included.

Request for Solution File

Ask an Expert for Answer!!
Programming Languages: Loop the program using a while loop to get the next
Reference No:- TGS01608589

Expected delivery within 24 Hours