Posted by Anita on Monday, October 29, 2012 at 11:07pm.
For this option, first ask the user how many items there will be. ("How many
items will there be?") Then, accept a name, a price, a name, a price, etc. until you have enough name-price pairs. You should then format the receipt so that each item shows up on a separate line, with the name left-aligned, spacing filled with periods, all the way to the prices, which should all show up in the format $X.XX (using more columns to the left if necessary).
• The entire width of the receipt must be exactly 30 characters wide. We won't test any inputs where
that's impossible, but you will have to figure out the spacing to make it happen.
• Accept floats as the prices. If the user types in 3.3456, then the price should post as $3.35 (exactly
how the format method behaves… hint hint).
• Include a "Total" line with the correct price, also aligned to the same 30 character width.
• Notice how in the example below, the price on one line and the name on another line might overlap.
• If any rows are exact duplicates – same name, same price - combine them by
adding a (x2) in front of the price. This line must show up exactly where the first item would have been.
No one has answered this question yet.
Answer this Question
Related Questions
computer science - Python 3 For this option, you will first ask "how many ...
math - At a production level of 1400 items, the total cost is $7250 and the ...
math - Bill buys x items at $3 each, y items at $5 each, and z items at 6 each. ...
math - Bill buys x items at $3 each, y items at $5 each, and z items at 6 each. ...
math - if u received 2 dozen items and sold three of those items the first day, ...
written communications - when your ordering goods from a distributor the best ...
statistics - 2. Punkey Electronics, a small manufacturer of electronic research ...
EEE - the solve of the shipment of 10 items has 2 items defective and 8 items ...
math - Suppose that Helen buys three items for 47 cents each, five items for 71 ...
Math - Marx clothing store is selling a lot of items. On monday 495 items were ...
For Further Reading