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

Write a class name StudentRecord with the following specifications – • Data memb

ID: 3764335 • Letter: W

Question

Write a class name StudentRecord with the following specifications –
• Data members:
name, marks[], major, term (use appropriate data type)
• Member functions:
o You are allowed to leave the constructor default
o Implement all get/set methods
o double findAverage( ) – returns the average mark of the student
o void displayProfile( ) – displays the profile of a student in following manner
Name: John Smith
Major: Computer Science
Term: Fall 2015
Term average: 90%
• Main function:
o Take input from user for name, major and term name
o Take input from the user for 5 courses s/he has enrolled in this term (you must
put a validation checking that the range of input such that 100<=marks>=0)
o Create an object of StudentRecord class
o Set name, major, term name and the marks[]
o Invoke displayProfile() function to display the information of the student
• Special instruction: You MUST submit following 3 files –
o StudentProfile.h
o StudentProfile.cpp
o StudentProfileMain.cpp

Explanation / Answer

Answer:

#include<iostream>

using namespace std;
class StudentRecord
{
private :
int m[4];
char name[20];
char usn[20];
char term[30];
float avg;
double sum;
public :
StudentRecord(){ sum=0.0;}
void read();
double findAverage();
void displayProfile();
};
void StudentRecord :: read()
{

cout<<"Enter the name of the student :";
cin>>name;
cout<<name<<endl;
cout<<"Enter the Major:";
cin>>usn;
cout<<"Enter the Term:";
cin>>term;
cout<<"Enter the marks of 5 courses :";
cin>>m[1]>>m[2]>>m[3]>>m[4]>>m[5];
findAverage();
}

double StudentRecord :: findAverage()
{
for(int i=1;i<=5;i++)
{
sum=sum+m[i];
}
avg=sum/5;
cout<<avg<<endl;
return avg;
}
void StudentRecord:: displayProfile()
{

cout<<" "<<usn<<" "<<name<<" "<<term<<" "<<avg;
}

int main()
{
int n,i;
StudentRecord s[10];

cout<<"Enter the no of students :";
cin>>n;
for(i=0;i<n;i++)
s[i].read();
cout<<"Major NAME Term AVEAGE MARKS ";
for(i=0;i<n;i++)
s[i].displayProfile();
return 0;
}

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