Write a class name StudentRecord with the following specifications –
• Data members:
name, marks[ ], major, term (use appropriate data type)
• Member functions:
- You are allowed to leave the constructor default
- Implement all get/set methods
- double findAverage( ) – returns the average mark of the student
- void displayProfile( ) – displays the profile of a student in following manner
Name: John Smith
Major: Computer Science
Term: Fall 2015
Term average: 90%
- Hint: Use getline function to include space
• Main function:
- Take input from user for name, major and term name
- 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)
- Create an object of StudentRecord class
- Set name, major, term name and the marks[]
- Invoke displayProfile() function to display the information of the student
#include <iostream>
usingnamespace std;
//defining a class name StudentRecord
class StudentRecord{
//defining the characteristics of StudentRecord
//Data members
string name;
int marks[];
string major;
string term;
//defining the function of StudentRecord
//Member functions
public:
StudentRecord();
void setName(string name);
void setMarks(int marks);
void setMajor(string major);
void setTerm(string term);
string getName();
int getMarks();
string getMajor();
string getTerm();
double findAverage();
void displayProfile();
};
//Implementation of the functions
//default constructor
StudentRecord::StudentRecord(){
cout << "constructor" << endl;
}
//defining mutators
string StudentRecord::getName(){
return name;
}
int StudentRecord::getMarks(){
return marks;
}
string StudentRecord::getTerm(){
return term;
}
//defining accesors
void StudentRecord::setName(string name){
}
void StudentRecord::setMarks(int marks){
}
void StudentRecord::setMajor(string major){
}
void StudentRecord::setTerm(string term){
}
void StudentRecord::setdisplayProfile(){
}
//member function
double StudentRecord::findAverage(){
return 0.0;
}
int main(){
//taking input from user for name, major and term name
int name, major, termname
cout << "Please enter name: ";
cin >> name;
cout << "Please enter major: ";
cin >> major;
cout << "Please enter term name: ";
cin >> termname;
//taking input from user for 5 courses she/he has enroled in this term
int course1, course2, course3, course4, course5;
cout << "Please enter 1st course enrolled in: ";
cin >> course1;
cout << "Please enter 2nd course enrolled in: ";
cin >> course2;
cout << "Please enter 3rd course enrolled in: ";
cin >> course3;
cout << "Please enter 4th course enrolled in: ";
cin >> course4;
cout << "Please enter 5th course enrolled in: ";
cin >> course5;
//validation checking that the range of input such that 100<=marks>=0?
//creating object of StudentRecord class?
//setting name, major, term name and the marks[]?
//invoking displayProfile() function to display the information of the student?
return 0;
}
#include <iostream>
usingnamespace std;
constint NUM_COURSES = 5;
//defining a class name StudentRecord
class StudentRecord{
//defining the characteristics of StudentRecord
//Data members
string name;
double marks[NUM_COURSES];
string major;
string term;
//defining the function of StudentRecord
//Member functions
public:
StudentRecord(); //default constructor
void setName(string name);
void setMarks(double marks[NUM_COURSES]);
void setMajor(string major);
void setTerm(string term);
string getName();
double getMarks();
string getMajor();
string getTerm();
double findAverage();
void displayProfile();
~StudentRecord(){
cout << "destructor" << endl;
}
};
//Implementation of the functions
//default constructor
StudentRecord::StudentRecord(){
cout << "constructor" << endl;
}
//defining mutators
string StudentRecord::getName(){
return name;
}
double StudentRecord::getMarks(){
return marks[NUM_COURSES];
}
string StudentRecord::getMajor(){
return major;
}
string StudentRecord::getTerm(){
return term;
}
double StudentRecord::findAverage(){
return 0.0;
}
//defining accesors
void StudentRecord::setName(string n){
name = n;
}
void StudentRecord::setMarks(double m){
marks[NUM_COURSES] = m;
}
void StudentRecord::setMajor(string maj){
major = maj;
}
void StudentRecord::setTerm(string t){
term = t;
}
int main(){
//taking input from user for name, major and term name
string name, major, term;
cout << "Please enter name: ";
cin >> name;
cout << "Please enter major: ";
cin >> major;
cout << "Please enter term name: ";
cin >> term;
//taking input from user for marks for 5 courses she/he has enroled in this term marks
int course1, course2, course3, course4, course5;
cout << "Please enter 1st enrolled in course mark: ";
cin >> course1;
cout << "Please enter 2nd enrolled in course mark: ";
cin >> course2;
cout << "Please enter 3rd enrolled in course mark: ";
cin >> course3;
cout << "Please enter 4th enrolled in course mark: ";
cin >> course4;
cout << "Please enter 5th enrolled in course: ";
cin >> course5;
//validation checking that the range of input such that 100<=marks>=0?
//creating object of StudentRecord class?
//setting name, major, term name and the marks[]?
//invoking displayProfile() function to display the information of the student?
return 0;
}
Please, check for errors and give me suggestions on how to do the stuff I haven't written code for in the main function.