Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Programming Assignment #1 Write a C program that determines the minimum grade, maximum grade, and class average of an exam. Your program should first prompt

Programming Assignment #1 Write a C program that determines the minimum grade, maximum grade, and class average of an exam. Your program should first prompt for how many grades, then each of the grades. Your program should first test that the number of grades to process is between 0 and 10. If number is not valid, your program should issue an error message as shown below, and re-prompt for the number of grades. Your program should then test that each grade entered is valid (i.e., between 0 and 100). If the grade entered is not valid, the program should issue an error message as shown below, and re-prompt for a correct grade. Once all grades are entered, your program should calculate the minimum grade, maximum grade, and class average for that exam. It will then print the grades listed (sorted) in ascending order. Note: There will be a 10 point deduction if your program does not sort the grades. Your program should store all the grades entered in integer array: grades[10]. The dialog with the user must look exactly like: Welcome to the Grade Calculator Enter the number of grades to process (0 - 10): 20 *** Invalid number of grades entered. *** Enter the number of grades to process (0 - 10): 5 Enter grade for student #1: 80 Enter grade for student #2: 90 Enter grade for student #3: 172 *** Invalid grade entered. Please enter 0 - 100. *** Enter grade for student #3: 100 Enter grade for student #4: 85 Enter grade for student #5: 97 The minimum grade is 80 The maximum grade is 100 The class average is 90.4 The 5 grades entered are: 80, 85, 90, 97, 100 Thank you for using the Grade Calculator Note: The blue text represents the "input" into your program. That is, what the user types in at the prompt. It is shown for clarity only here. Your input will not be blue. (Do not even attempt to try!). Once the user enters a valid number of grades to process, the program should run as described above. If the user chooses to enter 0 as the number of grades, the program should simply end as shown here: Welcome to the Grade Calculator Enter the number of grades to process (0 - 10): 0 Thank you for using the Grade Calculator Important: Do not use the qsort() function from the Standard C Library, it is a 10 point deduction. *** Sample Algorithm for Assignment #1 *** Note: This assignment can be solved many different ways. This algorithm simply illustrates one possible solution. Please feel free to ignore this algorithm and use your own design to solve this problem if desired. 1. Trap loop to prompt for number of grades(min 0 max 10) 2. Initialize stuff: 2.1 Set minimum equal to zero. 2.2 Set maximum equal to zero. 2.3 Set sum equal to zero. 3. Trap LOOP for each grade (grades[0] grades[n]) with edits. { Keep running total of sum of grades: Add each (good) grade to sum of grades. } 4. Calculate average as: sum of grades divided by number of grades. 5. Sort the stored array in ascending order with a bubble sort. 6. Display results: 6.1 Display minimum grade. 6.2 Display maximum grade. 6.3 Display class average. 8. Print loop to print the sorted array

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Practical Database Programming With Visual C# .NET

Authors: Ying Bai

1st Edition

0470467274, 978-0470467275

More Books

Students also viewed these Databases questions

Question

Explain how to build high-performance service delivery teams.

Answered: 1 week ago