Answered step by step
Verified Expert Solution
Link Copied!

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... blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Introduction To Programming With Java A Problem Solving Approach

Authors: John Dean

3rd International Edition

1260575241, 9781260575248

More Books

Students also viewed these Programming questions