Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In C++ with comments please Comments are very important Complete Programming Challenge #12 at the end of Chapter 11. Write a program that uses a

In C++ with comments please

Comments are very important

Complete Programming Challenge #12 at the end of Chapter 11.

Write a program that uses a structure to store the following data:

name (student name)

idnum (a numeric ID number)

tests (a POINTER to an array of dynamically allocated test scores)

average (average test score)

grade (course letter grade)

The program will track test scores for a group of students. It should ask the user how many students there are and how many test scores (validate that there is at least 1 student and at least 2 tests).

You will dynamically allocate an array of students. EACH student needs to have their tests array dynamically allocated.

Before you start, make sure your structure definition is correct. Talk to me if you have questions about it. There are two levels of dynamic memory allocation being used here. If you dont set things up correctly you will have major problems! If you have problems doing a variable number of tests and cant get help, do the problem such that the number of tests is always 3. You will get reduced credit but it will be better than being frustrated

After the arrays have been allocated, prompt for the name, id number, and scores for each student. Calculate and store the average and letter grade for each student.

Then print a report as shown in the sample output below.

Validation: Do not accept negative numbers for test scores.

Implement this project using the following functions: (follow these specs!)

Function: getData. Prompts the user to input students name, ID num, and test scores. Also calculates and stores the average and grade into the structure. Receives: an array of structures, an integer representing the number of students, and an integer representing the number of tests. No return value. Remarks: Validate that test scores are between 0 and 100

Function: calcLtr. Determines letter grade based on average. Receives: a float representing test average. Returns: the corresponding letter grade. Remarks: Should be used by getData.

Function: printReport. Prints each students name, ID number, average, and grade. Receives: an array of structures, and an integer representing the number of students. No return value. Remarks: Print average with 1 decimal place

Sample output: (Test case 1 - USE THIS DATA)

(Make sure to do a second test case with a different number of students and tests)

 
How many students do you have? -3 Must have at least 1 student! Please re-enter: 3 How many tests do you have grades for? 0 Must have at least 2 tests! Please re-enter: 4 Enter student name: Jim Smith Enter ID number: 123 Enter test score 1: 88 Enter test score 2: 70 Enter test score 3: 75 Enter test score 4: 82 Enter student name: Mary Johnson Enter ID number: 456 Enter test score 1: 90 Enter test score 2: 95 Enter test score 3: 98 Enter test score 4: 88 Enter student name: Tom Jones Enter ID number: 657 Enter test score 1: 70 Enter test score 2: 88 Enter test score 3: 85 Enter test score 4: 80 Grade Report Name IDNum Average Grade Jim Smith 123 78.8 C Mary Johnson 456 92.8 A Tom Jones 657 80.8 B 

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_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions

Question

Compare levels of resolution in conflict outcomes?

Answered: 1 week ago

Question

Strategies for Managing Conflict Conflict Outcomes?

Answered: 1 week ago