Visit www.myprogramminglab.com to complete select exercises online and get instant feedback.
Exercise
Write a program that inputs the name, quantity, and price of three items. The name may contain spaces. Output a bill with a tax rate of 6.25%. All prices should be output to two decimal places. The bill should be formatted in columns with 30 characters for the name, 10 characters for the quantity, 10 characters for the price, and 10 characters for the total. Sample input and output is shown as follows:
Input name of item 1:lollipopsInput quantity of item 1:10Input price of item 1:0.50Input name of item 2:diet sodaInput quantity of item 2:3Input price of item 2:1.25Input name of item 3:chocolate barInput quantity of item 3:20Input price of item 3:0.75
Your bill:
Item | Quantity | Price | Total |
lollipops | 10 | 0.50 | 5.00 |
diet soda | 3 | 1.25 | 3.75 |
chocolate bar | 20 | 0.75 | 15.00 |
Subtotal |
|
| 23.75 |
6.25% sales tax |
|
| 1.48 |
Total |
|
| 25.23 |
We need at least 10 more requests to produce the solution.
0 / 10 have requested this problem solution
The more requests, the faster the answer.