CJCoding With Joseph
15free / daySign inCreate account

Receipt Formatting

Create three float variables: price1 = 12.99f, price2 = 8.50f, and price3 = 15.25f. Calculate the total and use cout with setprecision to create a formatted receipt (see Expected Output).

Each price should be displayed with exactly 2 decimal places using fixed and setprecision(2). Calculate the total by adding all three prices together.

Expected Output:

Item 1: $12.99
Item 2: $8.50
Item 3: $15.25
Total: $36.74

= newline. No newline after the last line.

Hints4 available
Topics:
Printing
1
Tab to indent (Esc then Tab to move on) · Ctrl+Enter to run · Shift+Alt+F to format · Ctrl+Space to expand shortcuts (cout, fori)

Your Output

Run your code to see the output here...

Test Cases

Run your code to see test case results.