Write the C++ language program that should fulfill the following requirements:
Program should contain two classes as “Student” and “Instructor”. Within main() function, create the objects of these two classes. Display your student ID and name by passing as attributes(student ID, name) while instantiating the object of the “Student” class. Using the object of the Instructor Class, call its member function Input() to take input for the height of the 8 instructors then call its member function print() to display the average height of the instructors.
Declare data members by private and member functions by public access specifier for both classes.
Objects of both classes will be created in it, and respective member functions of these objects will be called.
Student(char *, char *)
Constructor of the Student class to display your own student ID and name
Function of Instructor class , it will take heights as input of 8 instructors
Function of Instructor class, it will display average height of 8 instructors.
Your program should display your own student ID and name on the top of the screen through passing as attributes at the time of instantiating object of the Student class i.e.
Student ID : MC104403787
Student Name : Rehman
Member function input() of the “Instructor” class should take height as input of the 8 instructors from the user i.e.
Enter Instructor 1 Height in Feet : 5.5
Member function print() of the “Instructor” class should display average height of the Instructors.
Sample output of the program:
using namespace std;
//starting the student class
char * StudentID;
char * StudentName;
Student(char *, char *);
void print(); //parametarized constructor of student class
~Student(); //destructor of student class
Student::Student(char *id, char *name)
StudentID = id;
StudentName = name;
cout”Student ID : ” StudentID “endl”;
cout “Student Name : ” StudentName “\n\n”;
for(i=1; i<=8; i++)
cout “Please enter the age of ” i ” Instructor in Feet : “;
cin >> age[i];
float totalage = 0, averageage = 0;
for(i=1; i<=8; i++)
averageage = totalage/8;
cout “Average Height in Feet : ” “averageage”;
Student student1((char *)”BC130403023″, (char *)”Aleena”);