Objective
- Program with selection statements
Preparation
- Read section 4.1 - 4.16 (pages 163 - 229) from Starting Out with C++ by Gattis.
- Print and complete Worksheet 8.
Programming
- Write a program that uses an if/else if statement(s) to determine and output the tax for a given income according to the following table of tax rates.
| Income |
Tax Rate |
| >= $70,000 |
23.5% |
| $40,000 - $69,999.99 |
20.6% |
| $20,000 - $39,999.99 |
18.2% |
| < $20,000 |
12.0% |
- Verify your program works correctly.
- Write a program that inputs a character from the keyboard and uses an switch statement to output a message based on the following table.
| Character |
Message |
| a |
a is for apple |
| b |
b is for banana |
| c |
c is for carrot |
| anything else |
you have selected an undefined food |
- Verify the program works correctly.
- Print the Grade Sheet. Show your programs to the instructor.
|