Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

For C++ program Your program should first prompt the user for the number of students they wish to enter. For each student, the user will

For C++ program

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 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.

void displayData(string*, double**, int);

The displayData function accepts a pointer to the array of student names, a pointer to the array of student test scores, 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

void cleanHeap(string*, double**, int);

The cleanHeap function accepts a pointer to the array of student names, a pointer to the array of student test scores, 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

Sample Run:

How many students do you have in the system? 3

Enter the student's name: John Doe

Enter how many tests John Doe took: 4

Enter grade # 1: 95.5

Enter grade # 2: 84.3

Enter grade # 3: 80

Enter grade # 4: 88.8

Enter the student's name: Anna Mull

Enter how many tests Anna Mull took: 3

Enter grade # 1: 60

Enter grade # 2: 55.9

Enter grade # 3: 77.4

Enter the student's name: Paige Turner

Enter how many tests Paige Turner took: -1

Please enter a positive number of tests taken

Enter how many tests Paige Turner took: 2

Enter grade # 1: 75.6

Enter grade # 2: -10.3

Please enter a grade between 0 and 100

Enter grade # 2: 50.5

You have 3 students in the system.

Name of student #1: John Doe

Grades for student #1: 95.5 84.3 80 88.8

Name of student #2: Anna Mull

Grades for student #2: 60 55.9 77.4

Name of student #3: Paige Turner

Grades for student #3: 75.6 50.5

// end of sample run.

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

Business Process Driven Database Design With Oracle PL SQL

Authors: Rajeev Kaula

1st Edition

1795532386, 978-1795532389

More Books

Students also viewed these Databases questions

Question

=+5.3. Show that m = E[ X ] minimizes E[(X- m)2].

Answered: 1 week ago

Question

Why do mergers and acquisitions have such an impact on employees?

Answered: 1 week ago

Question

2. Describe the functions of communication

Answered: 1 week ago