Extra Credit for Chapter 3 Quiz Exercise
You can turn this in if you received below a 90 on the quiz. It can add
10 points to your quiz grade, with the maximum being reaching a 90.
This is also a good study exercise for the midterm.
The end goal of this program is:
Print the numbers 2, 5, 8, & 11 using a for loop. If the number is
less than 5, print that number times 1.5 on the next line and format it
as currency. If the number is equal to 5 and less than 11, print the
number divided by 2 and format it as currency. If the number is 11 or
greater, print the number times 10 and format it as currency. When you
are done, print the total of all numbers and ask the user if they want
to do this again. If the user enters no, exit.
The output will be:
2
$3.00
5
$2.50
8
$4.00
11
$110.00
TOTAL: 145.50
Here are the steps:
1) Create a program that has a for loop to print 2 5 8 11. Compile and
test.
2) Make that program print the sum of 2, 5, 8 & 11 at the end of
the loop. Compile and test.
3) Add the if statement to handle If the number is less than 5, print
that number times 1.5 on the next
line and format it as currency. If the number is equal to 5 and less
than 11, print the number divided by 2 and format it as currency. If
the number is 11 or greater, print the number times 10 and format it as
currency. -- but don't worry about formatting as currency yet.
4) Add the newly created numbers to the sum as well as the original
numbers. Compile and test.
5) Above all the processing, add a statement to ask the user whether
they want to print, and take in their answer. Print only when
they don't answer no. Compile and test.
6) Add a while loop on top of that question to the user, and stop
when the user enters no. Compile and test.
7) Format your calculated numbers as currency.