Thursday, September 23, 2010

Lab Test 1 Review -- Calculator Class

Write a Calculator Class which following operations on 2 numbers:
1) Add
2) Subtract
3) Multiply
4) Divide
5) Square Root
6) Power
In the main() function:
1) Have a loop which goes on taking the operation from the user about which operation he wants to do and take input of 2 numbers for each operation.
2) If the user is done : he should type "done" and the program should shop.
3) If a non-recognized operation is input by the user the program should inform the user that the operation is in-appropriate and that the user should input again ( so the program should prompt the user again to enter operation and the 2 numbers

This program deals with :
1) Objects
2) Loop
3) if-else if-else

No comments: