Write a complete Java console application that prompts the user for a series of quiz scores. The user should type -1 to signify that the input of quiz scores is complete. Your program should then average the scores and display the result back to the user.
What will be an ideal response?
```
import java.util.*;
public class Average
{
public static void main(String args[])
{
Scanner stdin = new Scanner(System.in);
int quizGrade = 0;
int quizTotal = 0;
int quizCount = 0;
while(quizGrade != -1)
{
System.out.println("Enter the quiz grade or -1 to exit");
quizGrade = stdin.nextInt();
quizTotal += quizGrade;
quizCount++;
}
System.out.println("The quiz average is " +
QuizAverage(quizTotal, quizCount));
}
public static double QuizAverage(int total, int count)
{
return total/count;
}
}
```
You might also like to view...
When designating a name for the output file, Access defaults the location of any files to:
A) the folder in which the database currently resides. B) any available location. C) to the folder location specified by the user. D) None of the above.
You can only produce calculated results from a label box
Indicate whether the statement is true or false