Question
C++ Create a GradeBook class that takes grades and student names and displays information in an arrange way. The program also calculates a grade-point average
C++
Create a GradeBook class that takes grades and student names and displays information in an arrange way. The program also calculates a grade-point average for the inputted grades. You can input A, a, B, b, C, c, D, d, F and f for grades. But the inputted data could also be any characters, upper case, lower case or special character. The system should detect an improper grade input and allow reentering information. The grade of A is worth 4 points, B is worth 3 points, etc. You can use GradeBook program (attached) as a starting point.
The GradeBook class has the following methods and attributes.
- The GradeBook class has 4 private data members, courseName, letterGrades, countGrades, and studentName.
- The courseName has a string data type. It stores course name information.
- The letterGrades is a 100 elements character array. It stores all the inputs information which include the letter grades and non-letter grade information. For example, if you put a, $, a, C, 1, ! for the first 6 inputs the letterGrades first six elements should store A, $, A, C, 1, !.
- The countGrades is a 6 elements integer array. It stores the number of each letter grade and number of the error(s) input. For example, if you input 5 As, 6 Bs, 1 C, 2 Ds, 2 Es and 3 Fs, the countGrades array elements from 0 to 5 should contain 5, 6, 1, 2, 3 and 2.
- The studentName is a 100 element pointer character array. It stores students names.
- It also has several public member functions, GradeBook, setCourseName, getCourseName, initializeData, displayMessage, inputData, inputGrades, displayGradeReport, displayGrade, displayAllStudentsandGrades, calculateGrade, inputStudentName, displayStudentname, and ~GradeBook.
- The GradeBook function is a constructor. It takes a string and will initialize its data members data. The constructor also displays information which includes The Grade Book Constructor is called", *****The end of Grade Book Constructor.***** and the information in between these two statements.
- The setCourseName function takes a string and does not return anything. This function sets information for the string private data, courseName. It takes only the first 30 characters of the input string. If the inputted string shorter than 30 it will take everything. If it is longer than 30 it will keep the first 30 characters and truncate the rest of the information.
- The getCourseName function returns the private data, courseName, information. It does not accept any data.
- The initializeData function does not take and return anything. It initializes the private data members.
- The displayMessage function does not take and return anything. It displays "Welcome to the grade book for " information.
- The inputGrades function takes one integer and one character data and return an integer data. It generates loops to get any number (but it need to be less than 100) of inputs of proper grades and names. If the inputted grade is not any one of the following A, a, B, b, C, c, D, d, F, and f, the program will show ****Incorrect letter grade entered.**** message. The loop will be ended by inputting Ctl + D, or Ctl + Z (it depends on your computer system). I use the input integer to control which array element to store the character, and use the return integer to indicate a proper grade is set.
- The displayGradeReport function does not accept and return any data. It displays The total number sets of data input is ", "The total number of error input is ", The total number of students receive grades is ", "Number of students who received each letter grade and The class average is information. The class average is displayed in one digit double value.
- The calculateGrade function does not accept any data but return a double value. This function calculates the GPA (Grade Point Average) and returns the data.
- The ~GradeBook function is the destructor of the class. When it called it will clean up the memory and displays Destructor is called message.
- The inputData function does not take and return anything. It mainly to generate the Enter the letter grades." screen and call the inputGrades and inputStudentName functions.
- The displayAllStudentsandGrades function does not take and return anything. It displays The data entered is listed at the following: " as a heading, the students names and all the grades (information) entered in a 2 in a row tabulate format.
- The inputStudentName function takes an integer data and does not return any information. The function displays Enter a student name, get the inputted name, store the name and link the name to the studentName array. The integer argument is for indexing the array.
- The displayStudentname function takes an integer data and does not return anything. It displays the indexed students name. The integer argument is for indexing.
- The displayGrade function takes an integer data and does not return anything. It displays the indexed grade. The integer argument is for indexing.
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