Description
Introduction to Programming
with Java
Class: AverageGrades.java
Score: (Medium)
Prerequisites: While Loops, If-Else Statements, ACM Task Force Commands
Description:
Write a program that asks for the midterm grades of students from the user until he/she enters a negative value then calculate the class average. Also print an error message if there is no entry (i.e. user gives negative value for the first entry).
(Note that grades of the students are integers)
Sample Run #1:
This program computes average of exam grades
Enter new grade (Negative value if finished): 50
Enter new grade (Negative value if finished): 80
Enter new grade (Negative value if finished): 40
Enter new grade (Negative value if finished): -1
Average Grade of the class is 56.666666666666664
Sample Run #2:
This program computes average of exam grades Enter new grade (Negative value if finished): -1
You have not entered any grade!




Reviews
There are no reviews yet.