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

Need help whith this one, Write a C++ program to keep records and perform statis

ID: 3556083 • Letter: N

Question

Need help whith this one,

Write a C++ program to keep records and perform statistical analysis for a class of students of their final exam. The class may have up to 20 students. It should ask for how many students are in the class and accept that many that many student's final exam score. The input screen should look like the following. (Bold Italic is used to indicate typical input) How many students are in your class? 5 What is the final score for student 1: 80 What is the final score for student 2: 90 What is the final score for student 3: 70 What is the final score for student 4: 65 What is the final score for student 5: 75 The program then calculates the highest score, lowest score and the average score of the class. A sample output format for the above input is shown below. Highest Score : 90 Lowest Score: 65 Class Average: 76

Explanation / Answer

Here its the code for the question....

#include<iostream.h>
#include<conio.h>
class student
{
       private: int num_students;
           int mark[100];
       public: void getDetails( );
           void dispDetails( );
};
void student :: getDetails( )
{
   int i,count=1;
   cout<<"How many students are there in your class?";
   cin>>num_students;
   for(i=0;i<num_students;i++)
   {
   cout<<"What is the final score for the student "<<count<<":";
   cin>>mark[i];
   count++;
   }
}
void student :: dispDetails( )
{
   //Finding Highest score, Lowest score and class average
   int max_mark,j,average,sum_mark=0;
   int low_mark;
   if(mark[0]<mark[1])
   {
       low_mark=mark[0]; // setting low mark
       //cout<<"low mark is"<<low_mark;
       max_mark=mark[1]; // setting maximum mark
   }
   else
   {
       low_mark=mark[1];
       //cout<<low_mark;
       max_mark=mark[0]; // setting maximum mark
   }
   for(j=0;j<num_students;j++)
   {
   if(mark[j]<mark[j+1])
   {
   if(mark[j]<=low_mark)
   {
       low_mark=mark[j]; // setting low mark
   }
   else if(mark[j+1]>max_mark)
   {
       max_mark=mark[j+1];
       }
   }

   }
   //finding average mark
   int k;
   for(k=0;k<num_students;k++)
   {
   sum_mark=sum_mark+mark[k];
   }
   average=sum_mark/num_students;
   cout<<"Highest Score : "<<max_mark<<" ";
   cout<<"Lowest score : "<<low_mark<<" ";
   cout<<"Class Average : "<<average;
   //Fin
}
void main( )
{
   student s;
   clrscr( );
s.getDetails ( );
s.dispDetails ( );
getch( );
}