Question: Which value of grade could stop the while loop? import java.util.Scanner; public class Guess { public static void main(String[] args) { int secret =

Which value of grade could stop the while loop? import java.util.Scanner; public



Which value of grade could stop the while loop? import java.util.Scanner; public class Guess { public static void main(String[] args) { int secret = (int) (Math.random()*60 -1); Scanner keyboard = new Scanner(System.in); int grade, sum = 0, count = 0; System.out.println("Enter grade"); = grade keyboard.nextInt(); while (grade != secret) { // secret is sential value } sum += grade; count++; System.out.println("Enter grade"); grade = keyboard.nextInt(); double average = sum / (double) count; System.out.println("average grade is " + average + " with "+count + " students");

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

There seems to be an issue with the code provided The Scanner object is not used correctl... View full answer

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 Programming Questions!