Computer Science, asked by Riley001, 9 months ago

At least two programming implementations in C++ to demonstrate concepts like Encapsulation, Inheritance, Initialization and Finalization Dynamic Binding (mention the code please)

Answers

Answered by Spoodkid
2

Answer:

Try asking Vijay sir.

Explanation:

Answered by mad210203
0

Program is given below.

Explanation:

//Implementation of Inheritance.

#include<iostream>

using namespace std;

class EMPLOYEE

{

private:

int employee_number;

char employee_name[50];

float basic;

float DA;

float IT;

float GS;

float net_salary;

public:

void employee_details()

{

cout<<"Enter employee number: " ;

cin>>employee_number;

cout<<"Enter employee name: " ;

cin>>employee_name;

cout<<"Enter basic salary of the employee: " ;

cin>>basic;

}

void cal()

{

DA=basic*0.52;

GS=basic+DA;

IT=GS*0.30;

net_salary=(basic+DA)-IT;

}

void display()

{

cout<<"Employee number: "<<employee_number<<endl;

cout<<"Employee name: "<<employee_name<<endl;

cout<<"Basic salary of the employee: "<<basic<<endl;

cout<<"Gross salary of the employee: "<<GS<<endl;

cout<<"DA: "<<DA<<endl;

cout<<"Income tax: "<<IT<<endl;

cout<<"Net salary of the employee: " <<net_salary<<endl;

}

};

int main()

{

int n,i;

EMPLOYEE emp[10];

cout<<"Enter number of employees: ";

cin>>n;

cout<<endl;

for(i=1;i<=n;i++)

{

emp[i].employee_details();

cout<<endl;

emp[i].cal();

emp[i].display();

cout<<endl;

}

}

Refer the attached image for the output.

Attachments:
Similar questions