Write a C++ program to implement the single inheritance on the following. Create the class Employee with Employee ID(eID), employee name(ename) and position(pos) as data members and the member function getdata() to get eID, ename and pos. Create the another class Salary with number of hours worked per day(hpd), amount per hour(amph), number of days worked per month(dpm) and total monthly pay (tpay) as data members and the member functions are: • getsal(): gets hpd, amph and dpm. • calsal(): calculates total pay tpay=hpd*amph*dpm. • display(): displays eID, ename, pos, hpd, amph, dpm and tpay. Derive the class Salary from the class Employee in public mode. Get the data for one Customers (create one object in main), calculate the monthly salary, and display the information for this customers
OOPs
In today's technology-driven world, computer programming skills are in high demand. The object-oriented programming (OOP) approach is very much useful while designing and maintaining software programs. Object-oriented programming (OOP) is a basic programming paradigm that almost every developer has used at some stage in their career.
Constructor
The easiest way to think of a constructor in object-oriented programming (OOP) languages is:
Write a C++ program to implement the single inheritance on the following.
Create the class Employee with Employee ID(eID), employee name(ename) and position(pos) as data members and the member function getdata() to get eID, ename and pos.
Create the another class Salary with number of hours worked per day(hpd), amount per hour(amph), number of days worked per month(dpm) and total monthly pay (tpay) as data members and the member functions are:
• getsal(): gets hpd, amph and dpm.
• calsal(): calculates total pay tpay=hpd*amph*dpm.
• display(): displays eID, ename, pos, hpd, amph, dpm and tpay.
Derive the class Salary from the class Employee in public mode. Get the data for one Customers (create one object in main), calculate the monthly salary, and display the information for this customers?
Step by step
Solved in 2 steps