What is wrong with the following program? System.out.print(Enter the number of quarters: ); int quarters = in.nextInt();

Question:

What is wrong with the following program?


System.out.print("Enter the number of quarters: ");
int quarters = in.nextInt();
if (in.hasNextInt())
{
total = total + quarters * 0.25;
System.out.println("Total: " + total);
}
else
{
System.out.println("Input error.");
}

Fantastic news! We've Found the answer you've been seeking!

Step by Step Answer:

Related Book For  book-img-for-question
Question Posted: