Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I need help with this code in C++ please. Show screen shots of it working with the txt file. The txt file: please use the

I need help with this code in C++ please. Show screen shots of it working with the txt file.

image text in transcribed

image text in transcribed

The txt file: please use the text below for program to make sure it works that need to be read is lab9.txt:

1John Burke 25.00

2Jan Kovacs 1200.00 1

2Tom Banks 75.00 0

1Steven Brown 29.50

1Edward Brigham 35.30

1Jack Duckworth 19.75

1Craig Alwan 32.50

2Matt Brewning 1150.00 1

1Gale Stevens 15.89

2Janet Thompson 1324.00 1

2Beth Lucky 28.90 0

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 iles. The class should contain an overloaded constructor accepting name and pay rate as parameters, getName and getPayRate accessors, and method pay which should retum amount of pay (double) given hours worlked 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 retuning the amount of pay for a manager. If a manager is salaried, then payrate should be retumed, 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 Burkeearned $1000.00 Jan Kovacs earned $1200.00 Tom Banks earned $1400.00 Provide suitable heading, formatting for this output. 3. In main create an aray 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: 1John Burke 25.00 2Jan Kovacs 1200.00 1 2Tom Banks 75.00 o e hourly employee earning $25.00 per hour f salaried manager earning $1,200 per week f 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

Students also viewed these Databases questions

Question

Write a letter asking them to refund your $1,500 down payment.

Answered: 1 week ago