Question: Write an ANSI C program (include block comments) that determines the minimum grade, maximum grade, median grade and average of a class. Your program should

Write an ANSI C program (include block comments) that determines the minimum grade, maximum grade, median grade and average of a class. Your program should first prompt for class name, and then how many grades(at least 2), then each of the grades. Your program should test that each numeric grade value entered is valid (i.e., between 0 and 100) and id numbers will be from 1 to 99999 and displayed zero filled as shown in the sample below. If the grade entered is not valid, the program should issue an error message like the one shown below, and re-prompt for a correct grade, and do the same if an id number is invalid. Once all grades are entered, your program should calculate the minimum grade, maximum grade, and average, and median. It will then print the grades listed in descending order.(without sort the program will only be worth 50%). Your program should store all the grades entered in an array like: int grade[50]; and all of the id numbers in an array like: int id[50];

for example.

The dialog with the user must look exactly like:

Enter Class Name: Java I

Welcome to the Java I Grade Calculator

Enter the number of grades to process (2 - 50): 7

Enter id number for student #1: 1234

Enter grade for student #1: 80

Enter id number for student #2: 55511

Enter grade for student #2: 90

Enter id number for student #3: 23445

Enter grade for student #3: 100

Enter id number for student #4: 3765

Enter grade for student #4: 85

Enter id number for student #5: 37788

Enter grade for student #5: 572

*** Invalid grade entered. Please enter 0 - 100. ***

Enter grade for student #5: 72

Enter id number for student #6: 09932

Enter grade for student #6: 65

Enter id number for student #7: 00123

Enter grade for student #7: 96

Grade Report for Sears Academy Java I.

Id Number Grade

23445 100

00123 96

55511 90

03765 85

01234 80

37788 72

09932 65

The minimum is 65

The maximum is 100

The median grade is 85

The Java I class average is 84

Note: What the user types in is indicated by the blue area above. Once the user enters a valid number of grades to process, the program should run as described above. *** Sample Algorithm for Assignment #1 *** Note: This assignment can be solved many different ways. This algorithm simply illustrates one possible solution outline. Please feel free to ignore this algorithm and use your own design to solve this problem. Make sure you use traditional, efficient code(otherwise there may be deductions). 0. Prompt for class name 1. Trap loop to prompt for number of grades n (max 50) 2. Trap loop for each grade validating the grade and each id, up to a five digit number, and accumulate grade total. 3. Calculate average as: sum of grades divided by number of grades, rounded. 4. Sort the stored array in descending order with a bubble sort, and match the id numbers. 5. Print loop to print the sorted array in report format as shown. 6. Calculate the median. 6.1 If odd number entered median is the middle one. 6.2 If even number entered median is the average of the two middle ones. 7. Display results: 7.1 Display minimum grade. 0.1 Display maximum grade. 0.2 Display median 0.3 Display average.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!