Question: 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
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 items 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.
What am I doing wrong?
ion public static void main(String [ args) throws I0Exception f uto enerat metho tug // TODO Auto-generated method stub File inputFilenew File("input.txt"); if(!inputFile.exists)) inputFile.createNewFile Scanner in new Scanner(inputFile); PrintWriter author - new Printwriter(new Filewriter(inputFile, true)) System.out.print Ln(" Please Enter Items and it's Price. In When done type checkout n" do t Scanner in- new Scanner(System.in) string Item = in1.nextLine(); double Pricein1.nextDouble); author.printf(" %s " + .. %10.2f ", Item , Price ); Multiple markers at this line - Item cannot be resolved to a variable 1 changed line while(Item!"checkout"); double Price- inl.nextDouble); double total-0; total Price; author. printf(" Total " + " %10.2f ",total); in.close); author.close
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
