bartleby

Concept explainers

Question
Book Icon
Chapter 16, Problem 13PC
Program Plan Intro

Employee and ProductionWorker class

Program plan:

source.cpp:

  • Include the required header files to the program.
  • Declare the required function prototype.
  • Define the “main()” function.
    • Create the pointer and call the “create_Production_Worker” function with employee data.
    • If the pointer is not null, then Call the function “display()” to display the employee details.
  • Function definition for function “create_Production_Worker”.
    • Create an object for “ProductionWorker” class and pass the employee data.
    • Construct catch blocks for handling “InvalidEmployeeNumber”, “InvalidShift” and “InvalidPayRate”.
  • Function definition for function “display()”.
    • Display the name, number, hire date, shift name, shift number and pay rate using the respective function.

Employee.h:

  • Define the “Employee.h”.
    • Define an empty “InvalidEmployeeNumber” exception class.
    • In private, declare the required variable.
    • In public, create the constructor and return the name, number and hire date.
    • Create a mutator function for name, number and hire date.
    • Create an accessor function for name, number and hire date.

ProductionWorker.h:

  • Define the “ProductionWorkder.h”.
    • Define an empty “InvalidShift” exception class.
    • Define an empty “InvalidPayRate” exception class.
    • Create a “ProductionWorker” which is derived from “Employee” class.
    • In private, declare the required variable.
    • In public, create a default constructor which initializes the “shift” and “rate” as “0” and “0.0” respectively.
    • Invoke the constructor “productionWorker” which also calls the “Employee” constructor.
      • Assign the “shift” and “rate” as “empShift” and “empPayRate” respectively.
    • Create a mutator function for shift name, rate and shift number.
    • Create an accessor function for shift name, rate and shift number.
    • Create a bool() function to check the employee shift number and pay rate. If it is not valid, then call its relevant exception.  

Blurred answer
Students have asked these similar questions
help with this please
For the control system plot root Locus and find the D gain of stability? by Matlab Ris Kp (5+3) S+5 (s+1) +CUST s(S+2) (565+18) 5-1 5²+35+4
CIS 115 Introduction to C++ May I please have a written review expressing my gratitude for a tutor that has given me guidance throughout the computer programming course? Thank you so much!

Chapter 16 Solutions

Starting Out with C++ from Control Structures to Objects Plus MyLab Programming with Pearson eText -- Access Card Package (9th Edition)

Ch. 16.4 - Prob. 16.11CPCh. 16 - Prob. 1RQECh. 16 - Prob. 2RQECh. 16 - Prob. 3RQECh. 16 - Prob. 4RQECh. 16 - What is unwinding the stack?Ch. 16 - What happens if an exception is thrown by a classs...Ch. 16 - How do you prevent a program from halting when the...Ch. 16 - Why is it more convenient to write a function...Ch. 16 - Why must you be careful when writing a function...Ch. 16 - The line containing a throw statement is known as...Ch. 16 - Prob. 11RQECh. 16 - Prob. 12RQECh. 16 - Prob. 13RQECh. 16 - The beginning of a template is marked by a(n)...Ch. 16 - Prob. 15RQECh. 16 - Prob. 16RQECh. 16 - Write a function that searches a numeric array for...Ch. 16 - Write a function that dynamically allocates a...Ch. 16 - Make the function you wrote in Question 17 a...Ch. 16 - Write a template for a function that displays the...Ch. 16 - Prob. 21RQECh. 16 - Prob. 22RQECh. 16 - Prob. 23RQECh. 16 - Prob. 24RQECh. 16 - T F All type parameters defined in a function...Ch. 16 - Prob. 26RQECh. 16 - T F A class object passed to a function template...Ch. 16 - Prob. 28RQECh. 16 - Prob. 29RQECh. 16 - Prob. 30RQECh. 16 - Prob. 31RQECh. 16 - T F A class template may not be derived from...Ch. 16 - T F A class template may not be used as a base...Ch. 16 - Prob. 34RQECh. 16 - Prob. 35RQECh. 16 - try { quotient = divide(num1, num2); } cout The...Ch. 16 - template class T T square(T number) { return T T;...Ch. 16 - template class T int square(int number) { return...Ch. 16 - Prob. 39RQECh. 16 - Assume the following definition appears in a...Ch. 16 - Assume the following statement appears in a...Ch. 16 - Prob. 1PCCh. 16 - Prob. 2PCCh. 16 - Prob. 3PCCh. 16 - Prob. 4PCCh. 16 - Prob. 5PCCh. 16 - IntArray Class Exception Chapter 14 presented an...Ch. 16 - TestScores Class Write a class named TestScores....Ch. 16 - Prob. 8PCCh. 16 - Prob. 9PCCh. 16 - SortableVector Class Template Write a class...Ch. 16 - Inheritance Modification Assuming you have...Ch. 16 - Prob. 12PCCh. 16 - Prob. 13PC
Knowledge Booster
Background pattern image
Computer Science
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
Text book image
Microsoft Visual C#
Computer Science
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Cengage Learning,
Text book image
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781337671385
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT
Text book image
C++ Programming: From Problem Analysis to Program...
Computer Science
ISBN:9781337102087
Author:D. S. Malik
Publisher:Cengage Learning
Text book image
Programming Logic & Design Comprehensive
Computer Science
ISBN:9781337669405
Author:FARRELL
Publisher:Cengage
Text book image
C++ for Engineers and Scientists
Computer Science
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Course Technology Ptr