Write a program that asks the user what they would like to buy and then
prints them a bill.
- have five items in your store and ask how many of each the customer
would like
- print out subtotals for each item
- print out the subtotal of all items without tax
- print out the tax
- print out total
Add the following comments to the right places in your program:
- //Name: (Fill in your name)
- //Purpose: A Store Simulation
- //Date: (Fill in the Date)
- //Find out what the customer would like to buy
- //Print out subtotals for each item
- //Print out the subtotal of all items without tax
- //Print out the tax
- //Print out total
Make sure that you press the Indent button before you hand it in.
Enter the amount of each thing you would like to buy.
1. How many eggs would you like? 1
2. How many lettuces would you like? 2
3. How many cartons of milk would you like? 1
4. How many boxes of cookies would you like? 50
5. How many apples would you like? 1
****************************
* Fred's Food Bill
*
****************************
1 egg @ $0.30 = 0.30
2 lettuce @ $1.02 = 2.04
1 milk @ $1.25 = 1.25
50 cookie @ $3.00 = 150.00
1 apple @ $0.50 = 0.50
Subtotal: $154.09
Tax: $23.1135
Total: $177.2035
Sample 2
****************************
* Welcome to Fred's Food *
****************************
Enter the amount of each thing you would like to buy.
1. How many eggs would you like? 2
2. How many lettuces would you like? 1
3. How many cartons of milk would you like? 0
4. How many boxes of cookies would you like? 0
5. How many apples would you like? 0
****************************
* Fred's Food Bill
*
****************************
1 egg @ $0.30 = 0.60
2 lettuce @ $1.02 = 1.04
1 milk @ $1.25 = 0.0
50 cookie @ $3.00 = 0.0
1 apple @ $0.50 = 0.0
Subtotal: $1.64
Tax: $0.246
Total: $1.886
| R | |
| 1 | Program is handed in on time. It gets input from the user and prints out the total bill. |
| 2 | Level 1 and program has comments. Titles are outputted and the bill has lines like: 1 egg @ $0.30 = 0.60 |
| 3 | Level 2 and program has ASCII art and very nice formatting. All of the spacing around output is correct. |
| 4 | Level 3 and something extra. |
| 4+ | One of the best in the class. Many extra features. Much independent learning. |
These are some ideas that you can add to your program.