Create a Program ReceiptMaker.java that continuously reads user inputs consisting of two parts – a String (one word) containing the item in question, and a double containing that item’s price – and inserts them into a file ‘receipt.txt’ (creating it if it has to) formatted such that both the item and price have 10 characters dedicated to them until the user types in ‘checkout’. Once checkout occurs, the total price of all the items should also be written to receipt.txt.
Assignment 6
Instructions: Complete each problem by creating a Java program that performs the specified
actions.
1. Create a Program ReceiptMaker.java that continuously reads user inputs consisting of
two parts – a String (one word) containing the item in question, and a double containing
that item’s price – and inserts them into a file ‘receipt.txt’ (creating it if it has to) formatted
such that both the item and price have 10 characters dedicated to them until the user
types in ‘checkout’. Once checkout occurs, the total price of all the items should also be
written to receipt.txt.
Example:
Begin checking out items. When finished, type ‘checkout’.
carrots 4.99
apple_juice 3.00
soap 1.49
checkout
Contents of receipt.txt:
carrots
$4.99
apple_juice $3.00
soap
$1.49
Total
$9.48
What to turn in:
● ReceiptMaker.java