### Assignment 2

This assignment is fairly simple in concept, and can be equally as straightforward in design. You must design a menu driven calculator. This calculator will be of the RPN type made popular by Hewlett Packard. In this type of calculator, you enter two numbers and then instruct the computer what type of calculation should be performed on the numbers. For example if you wanted to add 2 and 3, you would enter a 2 and then a 3 and finally you would press the add key.

In this case you will enter one number into the computer, then another number, and finally, you will select the function that you want to perform from a menu. After one calculation is made you should give the user the option of doing an entirely new calculation, performing another calculation using the result of the previous calculation or quitting. That is, for example, you should be able to add two numbers and then add on a third one if you so desire. A sample run might look as follows:

Enter the first number: 5
Enter the second number: 8
Choose an operation to perform on 5 and 8 from the following list
1. Add the numbers
2. Subtract the second number from the first number
3. Divide the first number by the second number
4. Multiply the numbers
Which function would you like? 2
The result is -3
What would you like to do?
1. Start again
2. Perform another calculation using this result
3. Quit
Which option would you like? 2
Enter another number: 4
Choose an operation to perform on -3 and 4 from the following list
1. Add the numbers
2. Subtract the second number from the first number
3. Divide the first number by the second number
4. Multiply the numbers
Which function would you like? 4
The result is -12
Goodbye.

The only part of this that you we have not covered in a previous exercise is how to quit. The return 0; line that we include in the program can actually go anywhere. You should use this line to end your program.

At a minimum you should be able to perform a second calculation or add a third number. As a challenge you can try to see if you can do an unlimited number of calculations before quitting. You do not need to know any commands that we haven't already covered to do this. What you do need to use is something called recursion, a function calling itself. We will cover this later if you don't know what this is.

Your calculator must include addition, subtraction, multiplication and division. As an additional challenge you can add other math functions such as squaring a number.

This program should have comments on almost every line explaining what the program is doing. Additionally, while you may write the program in pairs, each person must explain in their own words how this program works. This explanation should be at least one paragraph and is essentially an English translation of your program. The purpose of this paragraph is to make it clear that you understand the operation of the program.

This program will be graded on the following factors:

1. How well it works.
2. How well structured your if/else statements are.
3. How easy your program is to follow, including your use of functions. This will include things like comments and variables that have meaningful names.
4. How well you understand your program based on the explanation that you write.
5. How creative your were in your approach to solving the problem.

This assignment will be due Tuesday, February 24. You must deposit the program in the class folder on the network by this date.