Already have an account? Get multiple benefits of using own account!
Login in your account..!
Remember me
Don't have an account? Create your account in less than a minutes,
Forgot password? how can I recover my password now!
Enter right registered email to receive password!
Aim: To implement a program to maintain information of employees in an educational institute using inheritance.
Code:
class staff
{
int code;
char name[20];
public:
void getdata();
void displaydata();
};
class teacher:staff
char subject[10];
char publication[20];
class typist:staff
int speed;
class regular:typist
int salary;
class casual:typist
int daily_wages;
class officer:staff
int grade;
void staff::getdata()
cout<<"\nEmployee code: ";
cin>>code;
cout<<"Name: ";
cin>>name;
}
void officer::getdata()
staff::getdata();
cout<<"Enter Officer Grade: ";
cin>>grade;
void teacher::getdata()
cout<<"Enter Subject: ";
cin>>subject;
cout<<"Enter Publication: ";
cin>>publication;
void typist::getdata()
cout<<"Enter typing speed: ";
cin>>speed;
void regular::getdata()
typist::getdata();
cout<<"Enter salary: ";
cin>>salary;
void casual::getdata()
cout<<"Enter daily Wages: ";
cin>>daily_wages;
void staff::displaydata()
cout<<"\nEmployee code: "< cout<<"\nName: "< } void officer::displaydata() { staff::displaydata(); cout<<"\nOfficer Grade: "< } void teacher::displaydata() { staff::displaydata(); cout<<"\nSubject: "< cout<<"\nPublication: "< } void typist::displaydata() { staff::displaydata(); cout<<"\nTyping speed: "< } void regular::displaydata() { typist::displaydata(); cout<<"\nSalary: Rs."< } void casual::displaydata() { typist::displaydata(); cout<<"Daily Wages: Rs."< } void main() { int ch; clrscr(); do { cout<<"\n\n1. Teacher\n2. Officer\n3. Typist\n4. Exit\nEnter your choice:"; cin>>ch; switch(ch) { case 1: teacher t1; cout<<"\n\tEnter Teacher's Details:"; t1.getdata(); cout<<"\n\t**Details Registered Successfully**\n\n"; t1.displaydata(); break; case 2: officer o1; cout<<"\n\tEnter Officer's Details:"; o1.getdata(); cout<<"\n**\tDetails Registered Successfully**\n\n"; o1.displaydata(); break; case 3: int typ; cout<<"\n1. Regular Typist\n2. Casual Typist\nEnter choice:"; cin>>typ; switch (typ) { case 1: regular tr1; cout<<"\n\tEnter Typist's Details:"; tr1.getdata(); cout<<"\n**\tDetails Registered Successfully**\n\n"; tr1.displaydata(); break; case 2: casual tc1; cout<<"\n\tEnter Typist's Details:"; tc1.getdata(); cout<<"\n**\tDetails Registered Successfully**\n\n"; tc1.displaydata(); break; default: cout<<"Wrong Selection!"; } } }while(ch!=4); getch(); } Output: 1. Teacher 2. Officer 3. Typist 4. Exit Enter your choice: 3 1. Regular Typist 2. Casual Typist Enter choice:2 Enter Typist's Details: Employee code: 555 Name: Anjali Enter typing speed: 53 Enter daily Wages: 250 ** Details Registered Successfully** Employee code: 555 Name: Anjali Typing speed: 53 wpm Daily Wages: Rs.250 1. Teacher 2. Officer 3. Typist 4. Exit Enter your choice:4
cout<<"\nName: "< } void officer::displaydata() { staff::displaydata(); cout<<"\nOfficer Grade: "< } void teacher::displaydata() { staff::displaydata(); cout<<"\nSubject: "< cout<<"\nPublication: "< } void typist::displaydata() { staff::displaydata(); cout<<"\nTyping speed: "< } void regular::displaydata() { typist::displaydata(); cout<<"\nSalary: Rs."< } void casual::displaydata() { typist::displaydata(); cout<<"Daily Wages: Rs."< } void main() { int ch; clrscr(); do { cout<<"\n\n1. Teacher\n2. Officer\n3. Typist\n4. Exit\nEnter your choice:"; cin>>ch; switch(ch) { case 1: teacher t1; cout<<"\n\tEnter Teacher's Details:"; t1.getdata(); cout<<"\n\t**Details Registered Successfully**\n\n"; t1.displaydata(); break; case 2: officer o1; cout<<"\n\tEnter Officer's Details:"; o1.getdata(); cout<<"\n**\tDetails Registered Successfully**\n\n"; o1.displaydata(); break; case 3: int typ; cout<<"\n1. Regular Typist\n2. Casual Typist\nEnter choice:"; cin>>typ; switch (typ) { case 1: regular tr1; cout<<"\n\tEnter Typist's Details:"; tr1.getdata(); cout<<"\n**\tDetails Registered Successfully**\n\n"; tr1.displaydata(); break; case 2: casual tc1; cout<<"\n\tEnter Typist's Details:"; tc1.getdata(); cout<<"\n**\tDetails Registered Successfully**\n\n"; tc1.displaydata(); break; default: cout<<"Wrong Selection!"; } } }while(ch!=4); getch(); } Output: 1. Teacher 2. Officer 3. Typist 4. Exit Enter your choice: 3 1. Regular Typist 2. Casual Typist Enter choice:2 Enter Typist's Details: Employee code: 555 Name: Anjali Enter typing speed: 53 Enter daily Wages: 250 ** Details Registered Successfully** Employee code: 555 Name: Anjali Typing speed: 53 wpm Daily Wages: Rs.250 1. Teacher 2. Officer 3. Typist 4. Exit Enter your choice:4
void officer::displaydata()
staff::displaydata();
cout<<"\nOfficer Grade: "< } void teacher::displaydata() { staff::displaydata(); cout<<"\nSubject: "< cout<<"\nPublication: "< } void typist::displaydata() { staff::displaydata(); cout<<"\nTyping speed: "< } void regular::displaydata() { typist::displaydata(); cout<<"\nSalary: Rs."< } void casual::displaydata() { typist::displaydata(); cout<<"Daily Wages: Rs."< } void main() { int ch; clrscr(); do { cout<<"\n\n1. Teacher\n2. Officer\n3. Typist\n4. Exit\nEnter your choice:"; cin>>ch; switch(ch) { case 1: teacher t1; cout<<"\n\tEnter Teacher's Details:"; t1.getdata(); cout<<"\n\t**Details Registered Successfully**\n\n"; t1.displaydata(); break; case 2: officer o1; cout<<"\n\tEnter Officer's Details:"; o1.getdata(); cout<<"\n**\tDetails Registered Successfully**\n\n"; o1.displaydata(); break; case 3: int typ; cout<<"\n1. Regular Typist\n2. Casual Typist\nEnter choice:"; cin>>typ; switch (typ) { case 1: regular tr1; cout<<"\n\tEnter Typist's Details:"; tr1.getdata(); cout<<"\n**\tDetails Registered Successfully**\n\n"; tr1.displaydata(); break; case 2: casual tc1; cout<<"\n\tEnter Typist's Details:"; tc1.getdata(); cout<<"\n**\tDetails Registered Successfully**\n\n"; tc1.displaydata(); break; default: cout<<"Wrong Selection!"; } } }while(ch!=4); getch(); } Output: 1. Teacher 2. Officer 3. Typist 4. Exit Enter your choice: 3 1. Regular Typist 2. Casual Typist Enter choice:2 Enter Typist's Details: Employee code: 555 Name: Anjali Enter typing speed: 53 Enter daily Wages: 250 ** Details Registered Successfully** Employee code: 555 Name: Anjali Typing speed: 53 wpm Daily Wages: Rs.250 1. Teacher 2. Officer 3. Typist 4. Exit Enter your choice:4
void teacher::displaydata()
cout<<"\nSubject: "< cout<<"\nPublication: "< } void typist::displaydata() { staff::displaydata(); cout<<"\nTyping speed: "< } void regular::displaydata() { typist::displaydata(); cout<<"\nSalary: Rs."< } void casual::displaydata() { typist::displaydata(); cout<<"Daily Wages: Rs."< } void main() { int ch; clrscr(); do { cout<<"\n\n1. Teacher\n2. Officer\n3. Typist\n4. Exit\nEnter your choice:"; cin>>ch; switch(ch) { case 1: teacher t1; cout<<"\n\tEnter Teacher's Details:"; t1.getdata(); cout<<"\n\t**Details Registered Successfully**\n\n"; t1.displaydata(); break; case 2: officer o1; cout<<"\n\tEnter Officer's Details:"; o1.getdata(); cout<<"\n**\tDetails Registered Successfully**\n\n"; o1.displaydata(); break; case 3: int typ; cout<<"\n1. Regular Typist\n2. Casual Typist\nEnter choice:"; cin>>typ; switch (typ) { case 1: regular tr1; cout<<"\n\tEnter Typist's Details:"; tr1.getdata(); cout<<"\n**\tDetails Registered Successfully**\n\n"; tr1.displaydata(); break; case 2: casual tc1; cout<<"\n\tEnter Typist's Details:"; tc1.getdata(); cout<<"\n**\tDetails Registered Successfully**\n\n"; tc1.displaydata(); break; default: cout<<"Wrong Selection!"; } } }while(ch!=4); getch(); } Output: 1. Teacher 2. Officer 3. Typist 4. Exit Enter your choice: 3 1. Regular Typist 2. Casual Typist Enter choice:2 Enter Typist's Details: Employee code: 555 Name: Anjali Enter typing speed: 53 Enter daily Wages: 250 ** Details Registered Successfully** Employee code: 555 Name: Anjali Typing speed: 53 wpm Daily Wages: Rs.250 1. Teacher 2. Officer 3. Typist 4. Exit Enter your choice:4
cout<<"\nPublication: "< } void typist::displaydata() { staff::displaydata(); cout<<"\nTyping speed: "< } void regular::displaydata() { typist::displaydata(); cout<<"\nSalary: Rs."< } void casual::displaydata() { typist::displaydata(); cout<<"Daily Wages: Rs."< } void main() { int ch; clrscr(); do { cout<<"\n\n1. Teacher\n2. Officer\n3. Typist\n4. Exit\nEnter your choice:"; cin>>ch; switch(ch) { case 1: teacher t1; cout<<"\n\tEnter Teacher's Details:"; t1.getdata(); cout<<"\n\t**Details Registered Successfully**\n\n"; t1.displaydata(); break; case 2: officer o1; cout<<"\n\tEnter Officer's Details:"; o1.getdata(); cout<<"\n**\tDetails Registered Successfully**\n\n"; o1.displaydata(); break; case 3: int typ; cout<<"\n1. Regular Typist\n2. Casual Typist\nEnter choice:"; cin>>typ; switch (typ) { case 1: regular tr1; cout<<"\n\tEnter Typist's Details:"; tr1.getdata(); cout<<"\n**\tDetails Registered Successfully**\n\n"; tr1.displaydata(); break; case 2: casual tc1; cout<<"\n\tEnter Typist's Details:"; tc1.getdata(); cout<<"\n**\tDetails Registered Successfully**\n\n"; tc1.displaydata(); break; default: cout<<"Wrong Selection!"; } } }while(ch!=4); getch(); } Output: 1. Teacher 2. Officer 3. Typist 4. Exit Enter your choice: 3 1. Regular Typist 2. Casual Typist Enter choice:2 Enter Typist's Details: Employee code: 555 Name: Anjali Enter typing speed: 53 Enter daily Wages: 250 ** Details Registered Successfully** Employee code: 555 Name: Anjali Typing speed: 53 wpm Daily Wages: Rs.250 1. Teacher 2. Officer 3. Typist 4. Exit Enter your choice:4
void typist::displaydata()
cout<<"\nTyping speed: "< } void regular::displaydata() { typist::displaydata(); cout<<"\nSalary: Rs."< } void casual::displaydata() { typist::displaydata(); cout<<"Daily Wages: Rs."< } void main() { int ch; clrscr(); do { cout<<"\n\n1. Teacher\n2. Officer\n3. Typist\n4. Exit\nEnter your choice:"; cin>>ch; switch(ch) { case 1: teacher t1; cout<<"\n\tEnter Teacher's Details:"; t1.getdata(); cout<<"\n\t**Details Registered Successfully**\n\n"; t1.displaydata(); break; case 2: officer o1; cout<<"\n\tEnter Officer's Details:"; o1.getdata(); cout<<"\n**\tDetails Registered Successfully**\n\n"; o1.displaydata(); break; case 3: int typ; cout<<"\n1. Regular Typist\n2. Casual Typist\nEnter choice:"; cin>>typ; switch (typ) { case 1: regular tr1; cout<<"\n\tEnter Typist's Details:"; tr1.getdata(); cout<<"\n**\tDetails Registered Successfully**\n\n"; tr1.displaydata(); break; case 2: casual tc1; cout<<"\n\tEnter Typist's Details:"; tc1.getdata(); cout<<"\n**\tDetails Registered Successfully**\n\n"; tc1.displaydata(); break; default: cout<<"Wrong Selection!"; } } }while(ch!=4); getch(); } Output: 1. Teacher 2. Officer 3. Typist 4. Exit Enter your choice: 3 1. Regular Typist 2. Casual Typist Enter choice:2 Enter Typist's Details: Employee code: 555 Name: Anjali Enter typing speed: 53 Enter daily Wages: 250 ** Details Registered Successfully** Employee code: 555 Name: Anjali Typing speed: 53 wpm Daily Wages: Rs.250 1. Teacher 2. Officer 3. Typist 4. Exit Enter your choice:4
void regular::displaydata()
typist::displaydata();
cout<<"\nSalary: Rs."< } void casual::displaydata() { typist::displaydata(); cout<<"Daily Wages: Rs."< } void main() { int ch; clrscr(); do { cout<<"\n\n1. Teacher\n2. Officer\n3. Typist\n4. Exit\nEnter your choice:"; cin>>ch; switch(ch) { case 1: teacher t1; cout<<"\n\tEnter Teacher's Details:"; t1.getdata(); cout<<"\n\t**Details Registered Successfully**\n\n"; t1.displaydata(); break; case 2: officer o1; cout<<"\n\tEnter Officer's Details:"; o1.getdata(); cout<<"\n**\tDetails Registered Successfully**\n\n"; o1.displaydata(); break; case 3: int typ; cout<<"\n1. Regular Typist\n2. Casual Typist\nEnter choice:"; cin>>typ; switch (typ) { case 1: regular tr1; cout<<"\n\tEnter Typist's Details:"; tr1.getdata(); cout<<"\n**\tDetails Registered Successfully**\n\n"; tr1.displaydata(); break; case 2: casual tc1; cout<<"\n\tEnter Typist's Details:"; tc1.getdata(); cout<<"\n**\tDetails Registered Successfully**\n\n"; tc1.displaydata(); break; default: cout<<"Wrong Selection!"; } } }while(ch!=4); getch(); } Output: 1. Teacher 2. Officer 3. Typist 4. Exit Enter your choice: 3 1. Regular Typist 2. Casual Typist Enter choice:2 Enter Typist's Details: Employee code: 555 Name: Anjali Enter typing speed: 53 Enter daily Wages: 250 ** Details Registered Successfully** Employee code: 555 Name: Anjali Typing speed: 53 wpm Daily Wages: Rs.250 1. Teacher 2. Officer 3. Typist 4. Exit Enter your choice:4
void casual::displaydata()
cout<<"Daily Wages: Rs."< } void main() { int ch; clrscr(); do { cout<<"\n\n1. Teacher\n2. Officer\n3. Typist\n4. Exit\nEnter your choice:"; cin>>ch; switch(ch) { case 1: teacher t1; cout<<"\n\tEnter Teacher's Details:"; t1.getdata(); cout<<"\n\t**Details Registered Successfully**\n\n"; t1.displaydata(); break; case 2: officer o1; cout<<"\n\tEnter Officer's Details:"; o1.getdata(); cout<<"\n**\tDetails Registered Successfully**\n\n"; o1.displaydata(); break; case 3: int typ; cout<<"\n1. Regular Typist\n2. Casual Typist\nEnter choice:"; cin>>typ; switch (typ) { case 1: regular tr1; cout<<"\n\tEnter Typist's Details:"; tr1.getdata(); cout<<"\n**\tDetails Registered Successfully**\n\n"; tr1.displaydata(); break; case 2: casual tc1; cout<<"\n\tEnter Typist's Details:"; tc1.getdata(); cout<<"\n**\tDetails Registered Successfully**\n\n"; tc1.displaydata(); break; default: cout<<"Wrong Selection!"; } } }while(ch!=4); getch(); } Output: 1. Teacher 2. Officer 3. Typist 4. Exit Enter your choice: 3 1. Regular Typist 2. Casual Typist Enter choice:2 Enter Typist's Details: Employee code: 555 Name: Anjali Enter typing speed: 53 Enter daily Wages: 250 ** Details Registered Successfully** Employee code: 555 Name: Anjali Typing speed: 53 wpm Daily Wages: Rs.250 1. Teacher 2. Officer 3. Typist 4. Exit Enter your choice:4
void main()
int ch;
clrscr();
do
cout<<"\n\n1. Teacher\n2. Officer\n3. Typist\n4. Exit\nEnter your choice:";
cin>>ch;
switch(ch)
case 1:
teacher t1;
cout<<"\n\tEnter Teacher's Details:";
t1.getdata();
cout<<"\n\t**Details Registered Successfully**\n\n";
t1.displaydata();
break;
case 2:
officer o1;
cout<<"\n\tEnter Officer's Details:";
o1.getdata();
cout<<"\n**\tDetails Registered Successfully**\n\n";
o1.displaydata();
case 3:
int typ;
cout<<"\n1. Regular Typist\n2. Casual Typist\nEnter choice:";
cin>>typ;
switch (typ)
regular tr1;
cout<<"\n\tEnter Typist's Details:";
tr1.getdata();
tr1.displaydata();
casual tc1;
tc1.getdata();
tc1.displaydata();
default:
cout<<"Wrong Selection!";
}while(ch!=4);
getch();
Output:
1. Teacher
2. Officer
3. Typist
4. Exit
Enter your choice: 3
1. Regular Typist
2. Casual Typist
Enter choice:2
Enter Typist's Details:
Employee code: 555
Name: Anjali
Enter typing speed: 53
Enter daily Wages: 250
** Details Registered Successfully**
Typing speed: 53 wpm
Daily Wages: Rs.250
Enter your choice:4
Program to draw a circle: int main(void) { /* request auto detection */ int gdriver = DETECT, gmode, errorcode; int midx, midy; int radius = 100;
This is what I need help with. "Create a program creates an interface allowing the user to select from some other programs I have made one being a money converter and the other ca
construct a console programme for a bank ATM machine.
FUNCTIONS It refers to a subprogram that is meant to do a certain task. It is basically used to execute a set of operations and return information to the main or calling functio
Question: (a) A bank has four types of accounts with annual interest rates as follows: Savings 8% Savings with Cheque Book 5% Current 4% Fixed deposits 10% Using
Encapsulation and Data Hiding The property of being a self-contained unit is known as encapsulation. The idea that the encapsulated unit can be used without knowing how it work
A palindrome is a string that reads the same from both the ends. Given a string S convert it to a palindrome by doing character replacement. Your task is to convert S to palindrome
world wide web commands
A string S is said to be "Super ASCII", if it contains the character frequency equal to their ascii values. String will contain only lower case alphabets (''a''-''z'') and the asci
C program to string compression: Write a program to define a sting and all operations on string. void main() {
Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!
whatsapp: +1-415-670-9521
Phone: +1-415-670-9521
Email: [email protected]
All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd