Fill This Form To Receive Instant Help
Homework answers / question archive / Write program in C++ , that stored the information about your client University in two terms
Write program in C++ , that stored the information about your client University in two terms. First stored their employee History with respect to department e.g.., (CS), second stored their student information with respect to his/her personal as well as academic record. You should require to store information by using classes and make proper display function for it.
Hint:
There will be two class with special member function.
a. Employee Class
b. Student Class
Each class have at least 6 - 8 Data Member Objects
Answer:
The running C++ source code is provided as below. The file name is main.cpp
you can use any C++ compiler to run this file. The comments have also been added for code segments for better understanding of the code. The output screenshot(capture) has also been attached for your reference.
Step-by-step explanation
Source Code:
#include<iostream>
#include <string>//for using String datatype
using namespace std;
// Declaraing Student class with 6-8 parameters
class Student
{
private:
int StudentId; //primary key
string StudentName;
string ContactNumber;
string ContactEmail;
string Address;
string DOB; //stores date of birth
char Grade ;//stores student grade
string PresentClass; //Current class of Student in which he is studing
//Constructor for initializing the Student information
public:
Student(int StudentId,string StudentName,string ContactNumber, string ContactEmail,string Address,string DOB,char Grade ,string PresentClass)
{
this->StudentName=StudentName;
this->StudentId=StudentId;
this->ContactNumber=ContactNumber;
this->ContactEmail=ContactEmail;
this->Address=Address;
this->DOB=DOB;
this->Grade=Grade;
this->PresentClass=PresentClass;
}
//StudentDisp() funtion will display the details of the Student
void StudentDisp()
{
cout<< StudentId;
cout<< StudentName;
cout<< ContactNumber;
cout<< ContactEmail;
cout<< Address;
cout<< DOB;
cout<< Grade;
cout<< PresentClass<<endl;
}
};
//Declaraing Employee class with 6-8 parameters
class Employee
{
private:
int EmployeeId; //primary key
string EmployeeName;
string ContactNumber;
string ContactEmail;
string Address;
string DOB;
string Department ;//Which department Employee belongs to
string Course; //Which course Employee teachs
//Constructor for initializing the Employee information
public:
Employee(int EmployeeId,string EmployeeName,string ContactNumber, string ContactEmail,string Address,string DOB,string Department ,string Course)
{
this->EmployeeId=EmployeeId;
this->EmployeeName=EmployeeName;
this->ContactNumber=ContactNumber;
this->ContactEmail=ContactEmail;
this->Address=Address;
this->DOB=DOB;
this->Department=Department;
this->Course=Course;
}
//This function displays the Emploees details
void EmployeeDisp()
{
cout<< EmployeeId;
cout<< EmployeeName;
cout<< ContactNumber;
cout<< ContactEmail;
cout<< Address;
cout<< DOB;
cout<< Department;
cout<< Course<<endl;
}
};
int main()
{
//instantiate Employee class using constructor
Employee e..m@gmail.com","newyork","12/11/1990","CS","JAVA");
emp.EmployeeDisp(); //display employee details
//instantiate Student class using constructor
Student st (..b@gmail.com","newyork","02/01/1996",'A',"High School");
st.StudentDisp(); //display Student details
return 0;
}
Output as Attached below-
As we can see in the output in the 1st row employee details are displayed and in the 2nd Row Student details are displayed.
PFA