write in c++ and use inheritance

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899603
Joined: Mon Aug 02, 2021 8:13 am

write in c++ and use inheritance

Post by answerhappygod »

write in c++ and use inheritance
Write In C And Use Inheritance 1
Write In C And Use Inheritance 1 (186.03 KiB) Viewed 45 times
An industry is maintaining two independent set of employees details (Technical and Non-technical). It has decided to give a New Year bonus for all employees based on the criteria as follows. For technical employees, if the basic pay is greater than or equal to Rs.15000 then the bonus will be 10% of his/her basic pay, and bonus will be 12% of basic pay otherwise. For non-technical group of employees, bonus of 15% of basic pay will be given when basic pay is greater than or equal to 7000 and a bonus of 20% of basic pay is given otherwise. Create a Base class Employee and a member function as calculateBonus(). Inherit two classes Technical and Non Technical from Employee. Develop a C++ program to using the concept of inheritance to determine the bonus for each employee and print them in the descending order of the bonus amount. Round off bonus amount to two decimal places. Input Read the number employees, 'n' ID number of employee 1 Type of employee 1 (0 for technical and 1 for non-technical) Basic pay of employee 1 ID number of employee2 Type of employee2 (0 for technical and 1 for non-technical) Basic pay of employee2 ID number of employee-n Type of employee-n (0 for technical and 1 for non-technical) Basic pay of employee-n Output Print details sorted by Bonus amount ID, Type and Bonus for employee1 ID, Type and Bonus for employee2 ID, Type and Bonus for employee-n

Test Input Expected 1 3 12345 Technical - 1500.00 12345 54321 Non-Technical - 1050.00 0 11223 - Technical - 960.00 15000 54321 1 7000 11223 0 8000 2 N 4 12345 12345 55443 54321 Non-Technical - 2250.00 Technical - 1789.00 Non-Technical - 1250.00 Technical 1140.00 1 11223 15000 54321 1 6250 11223 0 9500 55443 17890
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply