Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Lab Purpose Practice writing C++ object oriented programs that enable polymorphism, use inheritance, encapsulation and virtual functions. Always bring to class l. Gaddis book, How-to

image text in transcribed
Lab Purpose Practice writing C++ object oriented programs that enable polymorphism, use inheritance, encapsulation and virtual functions. Always bring to class l. Gaddis book, How-to handouts from Canvas and your class notes. 2. This assignment sheet & the grade sheet for this lab alrcady printed out 3. USB Flash drivel(s) or other storage media. Mandatory Instructions In this lab assignments you will create C++ classes and demonstrate inheritance, polymorphism, encapsulation and use of the virtual functions. 1. Design a base class Employee that will contain the following data members: name (string), payRate (double) which represents an hourly rate or salaried period rate. Use lab9employee.h and lab9employee.cpp files. The class should contain an overloaded constructor accepting name and pay rate as parameters, get Name and getPayRate accessors, and method pay which should return amount of pay (double) given hours worked as a parameter. double pay (double) const; 2. You will also need to design a Manager class that will inherit from Employee. Use lab9manager.h and lab9manager.cpp files. This class will have one data member: salaried (bool). It should have an overloaded constructor accepting name, pay rate, and true false value to designate salaried or not The class should have a getSalaried accessor function and a pay function returning the amount of pay for a manager. If a manager is salaried, then payrate should be returned, otherwise pay should be computed as pay rate times hours worked In your client code, lab9client.cpp, write a generic function PrintPay that will accept as parameters pointer to an Employee object, and hours worked. It should call the pay function and produce the following output: John Burke earned $1000.00 Jan Kovacs earned $1200.00 Tom Banks earned $1400.00 Provide suitable heading, formatting for this output. 3. In main create an array of 25 elements and populate with data read from data file, prog9.txt, until you run out of data The file contains various kinds of employees. Dynamically allocate appropriate employee object based on employee type stored in the data file as the first number in each line: e hourly employee earning $25.00 per hour 1John Burke 25.00 2Jan Kovacs 1200.00 1 2Tom Banks 75.00 0 salaried manager earning $1,200 per week hourly manager earning $35.00 per hour Create a loop that will call your generic function, PrintPay, for each employee and compute pay for 40.00 hours worked, i.e., one week

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

Types of physical Maps?

Answered: 1 week ago

Question

Explain Intermediate term financing in detail.

Answered: 1 week ago

Question

Types of cultural maps ?

Answered: 1 week ago

Question

Discuss the various types of leasing.

Answered: 1 week ago

Question

1. Does your voice project confidence? Authority?

Answered: 1 week ago