Question
Write a C++ program using object-oriented programming to implement a course grade book. You will define at least one class (GradeBook) The class GradeBook should
Write a C++ program using object-oriented programming to implement a course grade book. You will define at least one class (GradeBook) The class GradeBook should have at least the following memebrs: Member variables 1- An array (grades) of 100 elements of type double. 2- An integer (classSize) Member functions 1- A default constructor to initialize the classSize to 0 2- A custom constructor, which receives two parameters an integer and an array of type double to set the grades 3- A custom constructor, which receives a Boolean parameter sizeIncludedInFile a. If the value passed is true, the constructor will read the first value from a file Grades.txt to set classSize. The classSize will be used to indicate how many grades will be read from the same file to set the grades array. b. Otherwise, the user will have to input the value of the class size to set classSize. The classSize will be used to indicate how many grades will be read from the file Grades.txt to set the grades array. 4- A member function printAll to print the grades on the screen separated by a tab \t 5- A member function linearSearch to search the grades for a specific grades (passed as a parameter) using linear search algorithm. The function returns true if grade is found and false otherwise. 6- A member function binarySearch to search the grades for a specific grades (passed as a parameter) using binary search algorithm. The function returns true if grade is found and false otherwise. This function will call selectionSort member function in the function definition/implementation. 7- A member function absoluteMin to find the minimum grade and return it. 8- A member function absoluteMax to find the maximum grade and return it. 9- A member function minButGreaterThan to find the minimum grade which is greater than a certain value (passed as a parameter) and return its index. (private helper function) 10- A member function maxButLessThan to find the maximum grade which is less than a certain value (passed as a parameter) and return its index. (private helper function) 11- A member function classAverage to find the class average and return it. 12- A member function bubbleSort to sort the grades in descending order using the bubble sort algorithm. 13- A member function selectionSort to sort the grades in ascending order using the selection sort algorithm. This function will call the function minButGreaterThan member function in the function definition/implementation. Note: All operations will be based on the classSize and NOT the total size of the array. Note: Your program should account for all abnormal situations (e.g. zero classSize, divide by zero, negative grades, etc.) Note: The project will be split into three files (GradeBook.h, GradeBook.cpp, and main.cpp) The program will then display the following menu: 1) Enter grades manually 2) Enter grades using file Grades.txt (which has classSize as the first item) 3) Enter grades using file Grades.txt (which includes only grades) 4) Print All Grades 5) Search for a grade using sequential search 6) Search for a grade using binary search 7) Sort Grades in descending order using bubble sort 8) Sort Grades in ascending order using selection sort 9) Get maximum grade 10) Get minimum grade 11) Get class average 12) Exit
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started