Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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 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
Step: 1
There seems to be an issue with the code provided The Scanner object is not used correctl...Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started