MUST BE DONE IN C#!!! Create a class called StudentGrades. This class should be designed based off the following UML Diagram: class StudentGrades -double list grades_list + +AddGrade(double): void +RemoveGrade(double): bool +GetClassAverage(): double +GetHighestGrade(): double +GetLowestGrade(): double   Method Descriptions: a. - creates an empty array for the grades_list array. b. AddGrade – Adds the passed in grade to the list. Note that any number that is NOT 0 – 100 should be rejected. c. RemoveGrade – Removes the first occurrence of the passed in grade from the list. If the grade is not found, the method should return false. d. GetClassAverage() – Average the grades in the list and return the average. e. GetHighestGrade - Find and return the highest grade in the list. f. GetLowestGrade – Find and return the lowest grade in the list.   In main, create a StudentGrades object to test the listed methods. Add 10 grades randomly and call each method to test your class.

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter11: Inheritance And Composition
Section: Chapter Questions
Problem 6PE
icon
Related questions
icon
Concept explainers
Question

MUST BE DONE IN C#!!!

Create a class called StudentGrades. This class should be designed based off the following UML Diagram:

class StudentGrades

-double list grades_list

+<constructor>

+AddGrade(double): void

+RemoveGrade(double): bool

+GetClassAverage(): double

+GetHighestGrade(): double

+GetLowestGrade(): double

 

Method Descriptions:

a. <constructor> - creates an empty array for the grades_list array.

b. AddGrade – Adds the passed in grade to the list. Note that any number that is NOT 0 – 100 should be rejected.

c. RemoveGrade – Removes the first occurrence of the passed in grade from the list. If the grade is not found, the method should return false.

d. GetClassAverage() – Average the grades in the list and return the average.

e. GetHighestGrade - Find and return the highest grade in the list.

f. GetLowestGrade – Find and return the lowest grade in the list.

 

In main, create a StudentGrades object to test the listed methods. Add 10 grades randomly and call each method to test your class.

Expert Solution
Step 1

Algorithm:

 

1. Create a StudentGrades class with a List of double grades_list as a property, and define a constructor.

2. Create a method named AddGrade that takes a double grade as a parameter.

3. In AddGrade, check if the grade is between 0 and 100.

4. If the grade is between 0 and 100, add it to the grades_list and print a message indicating that the grade was added.

5. If the grade is not between 0 and 100, print a message indicating that the grade is invalid and cannot be added.

6. Create a method named RemoveGrade that takes a double grade as a parameter.

7. In RemoveGrade, check if the grade is in the grades_list.

8. If the grade is in the grades_list, remove it and print a message indicating that the grade was removed.

9. If the grade is not in the grades_list, print a message indicating that the grade was not found in the list.

10. Create a method named GetClassAverage that calculates the average of all grades in the grades_list and returns the result as a double.

11. Create a method named GetHighestGrade that finds the highest grade in the grades_list and returns the result as a double.

12. Create a method named GetLowestGrade that finds the lowest grade in the grades_list and returns the result as a double.

13. In Main, create a StudentGrades object and add 10 grades to the grades_list.

14. Calculate the class average, highest grade, and lowest grade with the methods from the StudentGrades object.

15. Remove the grade 75.7 from the grades_list with the RemoveGrade method.

trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 4 steps with 3 images

Blurred answer
Knowledge Booster
Types of Linked List
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT