Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write a C++ program that uses a structure to store the following data for each s

ID: 3875719 • Letter: W

Question

Write a C++ program that uses a structure to store the following data for each student:   

Member Name Description

--------------------------------------------------------------------------

1. name Student name

2. IDnum Student ID number

3. Test[3] Pointer to an array of test scores

4. average Average of test scores

5. grade Course letter grade (A, B, C, D, or F)

The program should keep 3 test scores for a group of students. It should ask the user how many students there are. It should then dynamically allocate an array of structures.

After the student array have been dynamically allocated, the program should ask for the ID number and the test scores for each student. The average test score should be calculated and stored in the average member of each structure. The course grade should be computed on the basis of the following grading scale

A 90-100

B 80 – 89

C 70 – 79

D 60 – 69

F below 60

The course grade should then be stored in the grade member for each structure. Once all this data is calculated, a table should be display on the screen listing each student's name, ID number, test scores, average test score and course grade.

Input validation:

   • all the data for each student is entered

   • Do not accept negative numbers for any test score.

An example of program output:

Input student data...

How many students: 2        

Enter information for student 1        

Student name: George Brown        

Student ID number: 123        

   Enter 3 test scores:                

test score 1: 87                

test score 2: 95                

test score 3: 79        

Enter information for student 2        

Student name: Nancy Smith        

Student ID number: 215        

Enter 3 test scores:                

   test score 1: 89                

   test score 2: 88                

   test score 3: 95
*** REPORT ****         

NAME ID TEST SCORES AVERAGE Grade

---------------------- ------ ---------------------    ----------------    ----------

George Brown 123    87   95   79    87.00 B

Nancy Smith    215    89   88   95    90.67 A
Press any key to continue . . .

Explanation / Answer

void main()
{  
   int t=0;
   cout<<" Input student data... How many students: ";
   cin>>t;
   string name[t];
   int id[t];
   int scores[t][3];
   float avg[t];
   char grade[t];
   for(int i=0;i<t;i++)
   {
       cout<<" Enter information for student"<<i+1;
       cout<<" Student name:";      
       cin>>name[i];
       cout<<" Student ID number:";
       cin>>id[i];
       cout<<" Enter 3 test scores:";
       cout<<" test score 1: ";
       cin>>scores[i][0];
       cout<<" test score 2: ";
       cin>>scores[i][1];
       cout<<" test score 3: ";
       cin>>scores[i][2];
       avg[i]=(scores[i][0]+scores[i][1]+scores[i][2])/3.0;
       if(avg/10>5)
       {
           grade[i]=(char)(74-(((int)avg)/10));
       }
       else
       {
           grade[i]='F';
       }
   }
   cout<<"*** REPORT ***";
   cout<<" NAME                     ID       TEST SCORES     AVERAGE     Grade";
   cout<<" ----------------------   ------     ---------------------    ----------------    ----------";
   for(int j=0;j<t;j++)
   {
       cout<<" "<<name[j]<<" "<<id[j]<<" "<<scores[j][0]<<" "<<scores[j][1]<<" "<<scores[j][2]<<" "<<avg[j]<<grade[j];
   }

cout<<" Press any key...";

}

Thank you:)

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote