1. Employee and ProductionWorker Classes Design a class named Employee. The class should keep the following information in Employee name Employee number • Hire date Write one or more constructors and the appropriate accessor and mutator functions for the class.

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter11: Inheritance And Composition
Section: Chapter Questions
Problem 8PE
icon
Related questions
Question

See attached images 

C++

1. Employee and ProductionWorker Classes
Design a class named Employee. The class should keep the following information in
• Employee name
• Employee number
• Hire date
Write one or more constructors and the appropriate accessor and mutator functions
for the class.
- 15 Inheritance, Polymorphism, and Virtual Functions
Next, write a class named ProductionWorker that is derived from the Employee class.
The ProductionWorker class should have member variables to hold the following
information:
• Shift (an integer)
• Hourly pay rate (a double)
The workday is divided into two shifts: day and night. The shift variable will hold an
integer value representing the shift that the employee works. The day shift is shift 1, and
the night shift is shift 2. Write one or more constructors and the appropriate accessor
and mutator functions for the class. Demonstrate the classes by writing a program that
uses a ProductionWorker object.
Transcribed Image Text:1. Employee and ProductionWorker Classes Design a class named Employee. The class should keep the following information in • Employee name • Employee number • Hire date Write one or more constructors and the appropriate accessor and mutator functions for the class. - 15 Inheritance, Polymorphism, and Virtual Functions Next, write a class named ProductionWorker that is derived from the Employee class. The ProductionWorker class should have member variables to hold the following information: • Shift (an integer) • Hourly pay rate (a double) The workday is divided into two shifts: day and night. The shift variable will hold an integer value representing the shift that the employee works. The day shift is shift 1, and the night shift is shift 2. Write one or more constructors and the appropriate accessor and mutator functions for the class. Demonstrate the classes by writing a program that uses a ProductionWorker object.
16. Exception Project
This assignment assumes you have completed Programming Challenge 1 of Chapter 15
(Employee and
ProductionWorker classes so they throw exceptions when the following errors occur:
ProductionWorker Classes). Modify the Employee and
• The Employee class should throw an exception named InvalidEmployeeNumber
when it receives an employee number that is less than 0 or greater than 9999.
• The ProductionWorker class should throw an exception named InvalidShift
when it receives an invalid shift.
• The ProductionWorker class should throw an exception named InvalidPayRate
when it receives a negative number for the hourly pay rate.
Write a driver program that demonstrates how each of these exception conditions
works.
Transcribed Image Text:16. Exception Project This assignment assumes you have completed Programming Challenge 1 of Chapter 15 (Employee and ProductionWorker classes so they throw exceptions when the following errors occur: ProductionWorker Classes). Modify the Employee and • The Employee class should throw an exception named InvalidEmployeeNumber when it receives an employee number that is less than 0 or greater than 9999. • The ProductionWorker class should throw an exception named InvalidShift when it receives an invalid shift. • The ProductionWorker class should throw an exception named InvalidPayRate when it receives a negative number for the hourly pay rate. Write a driver program that demonstrates how each of these exception conditions works.
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Knowledge Booster
Class
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
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
Microsoft Visual C#
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
Programming Logic & Design Comprehensive
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage