Created
June 14, 2013 05:39
-
-
Save sprintr/5779695 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #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