Question
IN C++ can someone help me with this please! Thank you! You have been asked to implement a program that determines the letter grade for
IN C++ can someone help me with this please! Thank you!
You have been asked to implement a program that determines the letter grade for students at a school. At this school, a students grade is determined entirely by tests. Because not every student has the same teacher, not every student will have taken the same number of tests. For example, student A may have taken 5 tests while student B has only taken 3 tests.
Your program should first prompt the user for the number of students they wish to enter. For each student, the user will be prompted to enter the students name, how many tests the student has taken, and the grade for each test. Each tests grade will be inputted as a number representing the grade for that test. Once each students information has been entered, the program will display the number of students. Additionally, each student will have their name, list of test scores, and an average of all test scores (shown as a letter grade) displayed.
Your program must have at least the following functions:
int inputData(string*&, double**&);
The inputData function accepts a string pointer and a pointer to a double pointer, both passed by reference. Inside the function, the user will be prompted to enter how many students they will input. For each student, the user will input the students name and a list of the students test scores. The function will return the number of students that have been entered.
After the function call, the string pointer should point to an array of every student name and the pointer to a double pointer should point to an array where each array entry contains an array of that students test scores. Remember that you do not know beforehand how many students will be entered or the number of test scores each student will have.
char* calcGrade(double**, int);
The calcGrade function accepts a pointer to the array of student test scores and the number of students. The function will calculate each students average test score, convert the score to a letter grade, and store the letter grade in a dynamically-allocated array. A standard grading scale will be used:
90 - 100 A
80 - 89 B
70 - 79 C
60 - 69 D
< 60 F
The function will return a pointer to the dynamically-allocated array containing every students letter grade.
void displayData(string*, double**, char*, int);
The displayData function accepts a pointer to the array of student names, a pointer to the array of student test scores, a pointer to the array of student letter grades, and the number of students. The function should output the following to the console:
The number of students,
and for each student
the students name
a list of the students test scores
the average for all test scores, shown as a letter grade
void cleanHeap(string*, double**, char*, int);
The cleanHeap function accepts a pointer to the array of student names, a pointer to the array of student test scores, a pointer to the array of student letter grades, and the number of students. Inside the function, anything that was dynamically-allocated should be cleaned up appropriately.
Additionally,
You must validate the users input
The number of students and the number of test scores must be a positive value
Each test score must be between 0 and 100, inclusive
You must use pointer arithmetic to access array elements instead of using the subscript operator. For example, to access the fifth element of arr, you must write *(arr + 4) instead of arr[4]
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