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...
Define pseudocode.
What will be an ideal response?
Answer the following statements true (T) or false (F)
1) In a valid XHTML document,
- or
- tags.
2) The width of all data cells in a table must be the same.
3) framesets can be nested.
4) You are limited to a maximum of 100 internal links per page.
5) All browsers can render framesets.
Which of the following will best help in reducing static electricity and increase equipment reliability?
A. High humidity and low temperature B. Humidity and temperature at levels comfortable for humans C. Low humidity and high temperature D. Low humidity and low temperature
The SelectedItem property of a ComboBox returns an integer indicating which choice is currently selected.
Answer the following statement true (T) or false (F)