Skip to content

Instantly share code, notes, and snippets.

@sprintr
Created June 14, 2013 05:39
Show Gist options
  • Select an option

  • Save sprintr/5779695 to your computer and use it in GitHub Desktop.

Select an option

Save sprintr/5779695 to your computer and use it in GitHub Desktop.
#include <iostream>
#include <string>
#include <cstdlib>
using namespace std;
class Employee
{
private:
int employeeId;
string employName;
string designation;
public:
void get() {
cout << "Enter your employee Id: " << endl;
cin >> employeeId;
cout << "Enter your employee name: " << endl;
cin >> employName;
cout << "Enter your designation: " << endl;
cin >> designation;
}
};
class Sallary : public Employee
{
private:
int basicPay;
int hrAllounce;
int dearnessAllounce;
int profitAllounce;
int sallary;
public:
void getInfo() {
cout << "Enter your basic pay: " << endl;
cin >> basicPay;
cout << "Enter your HR Allounce: " << endl;
cin >> hrAllounce;
cout << "Enter your dearness Allounce: " << endl;
cin >> dearnessAllounce;
cout << "Enter your profit Allounce: " << endl;
cin >> profitAllounce;
}
void calculate() {
sallary = (basicPay + hrAllounce + dearnessAllounce) - profitAllounce;
}
void display() {
cout << "Your complete sallary is: " << sallary << endl;
}
};
int main()
{
Sallary s1;
s1.get();
s1.getInfo();
s1.calculate();
s1.display();
system("pause");
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment