Assignment
2
1. Write prog02a.cpp that engages the user in a
discussion like the following. Make it
about yourself instead of Jamie Smith.
What
is your first name?
Jamie
What
is your last name?
Smith
Well,
Jamie Smith, how old are you?
20
That
means that you were born in either 1979 or 1980.
How
many miles from Oneonta is your home?
120
At
60 miles per hour it will take you 2.0 hours to get home.
What
is your college ID number?
0234567
What
is your favorite sport?
tennis
Let's
see if I have all the facts straight.
Your
name is Jamie Smith and you live 120.0 miles
distant
from Oneonta. Your id number is 0234567
and
your favorite sport is tennis. It was
nice
talking
with you.
Make sure your program is running
correctly and producing nice looking output.
2. Now write prog02b.cpp that does the following things:
1. Read in the salary (salary), tax rate (rate), and number of dependents (dependents) for a worker at the DOWNTOWN BAKERY.
2. Calculate the taxable income (taxable) from the following formula.
taxable = salary - 50 * dependents
3. Print the taxable income.
4. Calculate the net salary (net) and tax (tax) using the following formulas.
tax = rate * taxable
net = salary - tax
5. Print the tax and net salary.
Your output should print the dollar
amounts with dollar signs and two decimal places.
Test your program with the following
data:
salary
= $1000.00
tax
rate = 10%
number
of dependents = 2
Make sure your program is running
correctly and producing nice looking output.