Question: import java.util.Scanner; public class Problem1{ //main method public static void main(String[] args){ //Create a Scanner object to read input from the keyboard Scanner in =

 import java.util.Scanner; public class Problem1{ //main method public static void main(String[]

 import java.util.Scanner; public class Problem1{ //main method public static void main(String[] args){ //Create a Scanner object to read input from the keyboard Scanner in = new Scanner(System.in); //Declare String variables and initialize (based on input) String firstName = in.next(); String lastName = in.nextLine(); // swapName String swapName = lastName+" "+firstName; // get itemNumber String itemNumber = in.nextLine(); // get itemCost double itemCost = in.nextDouble(); // get item cashAmount double cashAmount = in.nextDouble(); // get the first 5 integers from itemNumber, and transfer it into company number. int company = Integer.parseInt(itemNumber.substring(0,5)); // get last 4 integers from itemNumber,and transfer it into the product number. int product = Integer.parseInt(itemNumber.substring(itemNumber.length()-4, itemNumber.length())); // Adding Tax rate itemCost = itemCost *1.15; //Calculate the change base on cashAmount cashAmount = cashAmount - itemCost; //True or False boolean negativeBalance = false; { if(cashAmount 

This is my code. I dont know whyb i cannot run, Can you help me fix this code? (Java)

Problem Description The fourth problem adds an additional functionality to the current program. You should indicate whether the cash balance is negative or positive. A negative cash balance denotes that the amount given by the customer is insufficient to process the current transaction. Input You will receive (from the user) the following as input (in order): The first and last name of the customer (e.g., Eric Poitras) The item to be purchased, identified through a barcode number (e.g., 1909238092) The cost of the item to be purchased by the customer (e.g., 8.50) The cash amount given by the customer (e.g., 10.00) Processing 1. Extract the product id and company id numbers 2. Calculate the balance for the transaction 3. Determine whether the balance is negative (true) or not (false) 4. Print the data stored in each variable in the corresponding format Output 1. Customer (Last, First): {LAST} {FIRST} 2 Item Number (Product Company): {PRODUCT}{COMPANY} 3. Item Cost (+ Sales Tax): {COST} 4. Change: (CASH) 5. Negative Balance (True/False): {ISNEGATIVE) Examples Input Output Customer (Last, First): Poitras Eric Eric Poitras Item Number (Product, Company): 8092 19092 1909238092 Item Cost (+ Sales Tax): 9.77 8.50 10.00 Change: 0.23 Negative Balance (True/False): false Customer (Last, First): Siegel Angela Angela Siegel Item Number (Product, Company]: 8095 19092 1909238095 Item Cost (+ Sales Tax): 8.63 7.5 Change: 138 110.0 Negative Balance (True/False): false

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!