Question
Write a program in C++ to compute the salaries of Employees of an organization who are having different designations. Use Virtual Base Class or Classes. Make necessary assumptions
Answer :
Word Count : 370
_________ _________ ___ _______ ________ _______.
__________ ____ ________ __________ _________ ____.
_____ ________ ______ ___ ______ __________ _______ _____ ______ __________ ___ _______.
_______ ______ __________ _________ ____.
___ _____ _____ _____ __________ ____ ______.
___ ____ ______ _____ ______ __________ _______ ______.
_____ _________ _____ ______ ________ _______ ______ ___ ________ ___ _______.
_____ _____ _____ _______ ________ __________ ______ _____ __________ _______.
____ ____ ______ _____ __________ _____.
________ ________ ____ ________ ______ ____ _____ ________ _____.
___ _____ _______ _______ _______ ____ _____ ____ _________ __________.
_____ ________ _______ _______ _______ _____.
___ __________ ________ ____ ___ ________ ______ _______ ________.
_______ __________ ________ ____ _____ _____ __________ __________ ________ ___.
______ ____ ____ __________ ___ _________.
______ _________ ____ ___ __________ ___ ________ ___ ______ ____ ______.
_____ ____ ___ ________ _____ _________.
_________ ___ ________ ___ __________ ___ ____ ____.
_____ _____ ________ ___ ___ ______ _______ ______.
______ _____ __________ ___ ___ ___ _____ ________ ______ _____ ______.
______ ______ ___ _______ _________ ___ ___.
_________ ____ _____ _______ _______ _______ ___ _______ ________ ________.
__________ _____ _________ _______ _____ __________.
____ ___ ___ ____ _______ ___.
______ __________ ______ ____ ____ __________ ____ ____ ____ ______.
_______ ________ ________ __________ _________ _________ __________ ____ _______ _________ ________ _______.
________ ____ _____ __________ ________.
___ ______ ________ __________ ____ _____ ____.
___ ___ ________ ______ _________ ____.
______ ________ ___ _________ _______ __________ _______.
________ _______ _______ _____ _________.
________ ________ ____ _________ ____ _____ ___ ________ ____ _________.
_______ _____ _______ ___ _______ _______ ________.
Skip in 10
```cpp
#include <iostream>
#include <string>
using namespace std;
class Employee {
protected:
string name;
int id;
double basicSalary;
public:
Employee(string n, int i, double salary) : name(n), id(i), basicSalary(salary) {}
virtual double calculateSalary() = 0; // pure virtual function
void display() {
cout << "Employee ID: " << id << endl;
cout << "Employee Name: " << name << endl;
cout << "Basic Salary: " << basicSalary << endl;
__________ ____ ________ __________ _________ ____.
_____ ________ ______ ___ ______ __________ _______ _____ ______ __________ ___ _______.
_______ ______ __________ _________ ____.
___ _____ _____ _____ __________ ____ ______.
___ ____ ______ _____ ______ __________ _______ ______.
_____ _________ _____ ______ ________ _______ ______ ___ ________ ___ _______.
_____ _____ _____ _______ ________ __________ ______ _____ __________ _______.
____ ____ ______ _____ __________ _____.
________ ________ ____ ________ ______ ____ _____ ________ _____.
___ _____ _______ _______ _______ ____ _____ ____ _________ __________.
_____ ________ _______ _______ _______ _____.
___ __________ ________ ____ ___ ________ ______ _______ ________.
_______ __________ ________ ____ _____ _____ __________ __________ ________ ___.
______ ____ ____ __________ ___ _________.
______ _________ ____ ___ __________ ___ ________ ___ ______ ____ ______.
_____ ____ ___ ________ _____ _________.
_________ ___ ________ ___ __________ ___ ____ ____.
_____ _____ ________ ___ ___ ______ _______ ______.
______ _____ __________ ___ ___ ___ _____ ________ ______ _____ ______.
______ ______ ___ _______ _________ ___ ___.
_________ ____ _____ _______ _______ _______ ___ _______ ________ ________.
__________ _____ _________ _______ _____ __________.
____ ___ ___ ____ _______ ___.
______ __________ ______ ____ ____ __________ ____ ____ ____ ______.
_______ ________ ________ __________ _________ _________ __________ ____ _______ _________ ________ _______.
________ ____ _____ __________ ________.
___ ______ ________ __________ ____ _____ ____.
___ ___ ________ ______ _________ ____.
______ ________ ___ _________ _______ __________ _______.
________ _______ _______ _____ _________.
________ ________ ____ _________ ____ _____ ___ ________ ____ _________.
_______ _____ _______ ___ _______ _______ ________.
IGNOU ACADEMY
Your IGNOU journey, made easier.
- Solved Assignments
- Study Notes
- Guess Papers
- Question Papers
Continue Reading — It's Free
Sign in with Google to unlock more of this answer.
✓ Free access
✓ Unlock up to 60% of the answer
✓ No payment required
✓ Unlock up to 60% of the answer
✓ No payment required
Quick Google sign-in. No separate registration form.