130k views
2 votes
Write code that prompts for three integers, averages them, and prints the average. Make your code robust against invalid input; if the user types a non-number, re-prompt with the same prompt message. (You may want to look at the getInt method discussed in Chapter 5. You can call that method in your solution if you like.) Here is an example dialogue: Type an integer: 5 Type an integer: 2 Type an integer: 17 Average: 8.0

User Blau
by
4.6k points

1 Answer

5 votes

Final answer:

This statistics exercise involves defining terms related to a study that aims to determine the average number of glasses of milk college students drink per day. The sample consists of five students, and the data are their responses regarding milk consumption.

Step-by-step explanation:

The exercise provided is related to statistics in mathematics, particularly focusing on determining an average or mean. When conducting a study to determine the average number of glasses of milk college students drink per day, various statistical terms are involved. In this scenario, the population would be all college students. The sample consists of the five students asked in the English class.

The parameter is the average number of glasses of milk that all college students drink per day, which is generally unknown and the target of estimation. The statistic is the average number of glasses of milk reported by the five students from the sample, which in this case would be calculated as (1+0+1+3+4)/5 glasses. A variable might be 'the number of glasses of milk a student drinks per day', and the data are the individual responses from the five students (1, 0, 1, 3, and 4 glasses).

User Ashwinjv
by
5.2k points