In this line I need to input the following "MacBook Pro" however it brings up and error. This is the code in question.
System.out.print("What brand of computer do you wish to purchase? "); // user prompt
model = scanner.next(); // read input here as a string
This is the following error
Exception in thread "main" java.lang.NumberFormatException: For input string: "pro"
at sun.misc.FloatingDecimal.readJavaFormatString(Unknown Source)
at sun.misc.FloatingDecimal.parseDouble(Unknown Source)
at java.lang.Double.parseDouble(Unknown Source)
at p2code.Computer.main(Computer.java:22)
Declaration added for clarification
Scanner scanner = new Scanner(System.in); // Declare a Scanner object here to be used for input
String input;
String brand;
String model;
Lines 20-23 below
System.out.print("Enter the cost of the computer: "); //user prompt
input=scanner.next(); //reads input as string
price = Double.parseDouble(input); // converts string to double and stores in price variable
totalTax = (price * kTax);