Part 3: Write a sales tax calculator for a world without
pennies or nickels
For this program, you will get an input price from the user, and then you will calculate
7.75% sales tax rounded to the nearest dime. You'll have to think a little bit about
how you can use the round() function to round a number to the nearest tenth. Take a
look at the <cmath> library documentation for more information on the round()
function.
After you've calculated the sales tax, you'll output the total price as well, and the
autograder will be looking for a specific kind of formatting. Here are some examples of
my solution's output to give you an idea of how your formatting should look:
? solution ./salesTax
Enter the price: 12.20
$12.20
+ $0.90
$13.10
? solution ./salesTax
Enter the price: 47.30
$47.30
+ $3.70
$51.00
? solution ./salesTax
Enter the price: 54.30
$54.30
+ $4.20
$58.50
solution