This is for a friend of mine who is having trouble with Java for school.
I do know some programming, but not Java.
Scanner kbReader = new Scanner(System.in);
System.out.print("Name of item: ");
String name = kbReader.next();
System.out.println("Original price of item: $");
double price = kbReader.nextDouble();
Outputs:
Name of item: Coat
Original price of item: $
10
Why is the input for "Original price of item: $" on the next line?
I was guessing it was because I went from String
to double
, but can't think of a different way to do it?