Long Island University · Brooklyn Campus · Computer Science

CS102 · Fall 2011 · Programming 1

CS102 · Fall 2011 · Programming 1

**due at 6pm on **

This program is a small calculator with a choice of arithmetic operators. Here is **one** sample run showing different cases that can occur. You will use `while`

loops to run the program continuously (until user chooses to quit) and to validate menu inputs.

```
Do you want to
1. Add
2. Subtract
3. Multiply
4. Divide
0. Quit
Your choice: 1
Enter the two numbers: 4 5
Answer: 4 + 5 is 9
Do you want to
1. Add
2. Subtract
3. Multiply
4. Divide
0. Quit
Your choice: 3
Enter the two numbers: 3 8
Answer: 3 * 8 is 24
Do you want to
1. Add
2. Subtract
3. Multiply
4. Divide
0. Quit
Your choice: 9
INVALID CHOICE, try again.
Your choice: -1
INVALID CHOICE, try again.
Your choice: 2
Enter the two numbers: 9 4
Answer: 9 - 4 is 5
Do you want to
1. Add
2. Subtract
3. Multiply
4. Divide
0. Quit
Your choice: 0
Thanks for calculating with us!
```

©2011 Christopher League · some rights reserved · CC by-sa