Working Hard 2. The world is full of hardworking individuals. There are all types of workers, including those that are doctors, lawyers, software engineers, and sales. Every worker has the following characteristics: • Constructor (accepts values for name and salary) • Name (type string) • Salary (type double) For name and salary, implement the accessor and mutator functions. In addition, implement the following function:

Programming Logic & Design Comprehensive
9th Edition
ISBN:9781337669405
Author:FARRELL
Publisher:FARRELL
Chapter11: More Object-oriented Programming Concepts
Section: Chapter Questions
Problem 8RQ
icon
Related questions
Question

c++ polymorphism

Working Hard
2. The world is full of hardworking individuals. There are all types of workers,
including those that are doctors, lawyers, software engineers, and sales. Every
worker has the following characteristics:
• Constructor (accepts values for name and salary)
• Name (type string)
• Salary (type double)
For name and salary, implement the accessor and mutator functions. In addition,
implement the following function:
double salaryPerWeek()
Make sure that the Worker class is abstract (i.e. one of the functions must be a pure
virtual function - it is up to you what you want to do for that). Keep in mind that, on
average, doctors earn $294,000 per year, lawyers earn $144,230 per year, software
Transcribed Image Text:Working Hard 2. The world is full of hardworking individuals. There are all types of workers, including those that are doctors, lawyers, software engineers, and sales. Every worker has the following characteristics: • Constructor (accepts values for name and salary) • Name (type string) • Salary (type double) For name and salary, implement the accessor and mutator functions. In addition, implement the following function: double salaryPerWeek() Make sure that the Worker class is abstract (i.e. one of the functions must be a pure virtual function - it is up to you what you want to do for that). Keep in mind that, on average, doctors earn $294,000 per year, lawyers earn $144,230 per year, software
engineers earn $108,080 per year, and salespeople earn $64,310 per year. Assume
that a year is 52 weeks long.
Once you've created a base class for the worker and derived classes for each of
the 4 types of workers, write a driver (test) program which shows salaries for
each of the 4 types of workers. You must split all of the classes into their respective .h
and .cpp files, even if they are small.
Transcribed Image Text:engineers earn $108,080 per year, and salespeople earn $64,310 per year. Assume that a year is 52 weeks long. Once you've created a base class for the worker and derived classes for each of the 4 types of workers, write a driver (test) program which shows salaries for each of the 4 types of workers. You must split all of the classes into their respective .h and .cpp files, even if they are small.
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Transitive relations
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Programming Logic & Design Comprehensive
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage