write a program that uses a loop to calculate the average score of a given number of
Question:
write a program that uses a loop to calculate the average score of a given number of quizzes.
The program should accept the number of quizzes, and the score for each quiz from the user. Scores should be between 0 to 20 points. They can include decimals.
The program should satisfy the following conditions:
If the score is lower than 0 (zero), the program should display the message "Enter a score between 0-20 points"
If the score is greater than 20, the program should display the message "Enter a score between 0-20 points"
The output of the average score calculation should include no more than two decimals.
For example, if the user enters a total number of 5 quizzes and the scores 19.759, 15.40, 13, 10, and 9, the output should display an average score of 13.43 points.
Use the following two examples to test your code:
Expected Output:
How many quizzes? 5
Enter score: 19.759
Enter score: 15.40
Enter score: 13
Enter score: 10
Enter score: 9
The average score is 13.43 points
Expected output with scores outside of the 0-20 point range:
How many quizzes? 4
Enter score: 12
Enter score: 22
Enter a score between 0-20 points
Enter score: -1
Enter a score between 0-20 points
Enter score: 10
Enter score: 20
Enter score: 19
The average score is 15.25 points
Java An Introduction To Problem Solving And Programming
ISBN: 9780134462035
8th Edition
Authors: Walter Savitch