What do I need to change so it prints the scores that were over 10 public static void main(String[] args) { Scanner keyboard = new Scanner(System.in); int count = 0; int score = 0; final int sentinel = 999; // int sum = 0; // System.out.print("Please enter a score or enter 999 to quit:"); // keyboard.nextInt(); // keyboard.nextLine(); while (score != sentinel) { System.out.print("Please enter a score or enter 999 to quit:"); keyboard.nextInt(); keyboard.nextLine(); if (score > 10) count++; System.out.println("There were " + count + "scores over 10"); }
What do I need to change so it prints the scores that were over 10
public static void main(String[] args)
{
Scanner keyboard = new Scanner(System.in);
int count = 0;
int score = 0;
final int sentinel = 999;
// int sum = 0;
// System.out.print("Please enter a score or enter 999 to quit:");
// keyboard.nextInt();
// keyboard.nextLine();
while (score != sentinel)
{
System.out.print("Please enter a score or enter 999 to quit:");
keyboard.nextInt();
keyboard.nextLine();
if (score > 10)
count++;
System.out.println("There were " + count + "scores over 10");
}
Step by step
Solved in 3 steps with 1 images