![EBK C HOW TO PROGRAM](https://www.bartleby.com/isbn_cover_images/9780133964639/9780133964639_largeCoverImage.jpg)
Concept explainers
(Payroll System Modification) Modify the payroll system of Figs20.9.—20.17 to include additional Employee subclasses Pieceworker and Hourlyworker. A Pieceworker represents an employee whose pay is based on the number of pieces of merchandise produced. An HourlyWorker represents an employee whose pay is based on an hourly wage and the number of hours worked. Hourly workers receive overtime pay (1.5 times the hourly wage) for all hours worked in excess of 40 hours.
Class Pieceworker should contain private instance variables wage (to store the employee’s wage per piece) and pieces (to store the number of pieces produced). Class Hourlyworker should contain private instance variables wage (to store the employees wage per hour) and hours (to store the hours worked). In class Pieceworker, provide a concrete implementation of method earnings that calculates the employee’s earnings by multiplying the number of pieces produced by the wage per piece. In class Hourlyworker, provide a concrete implementation of method earnings that calculates the employee’s earnings by multiplying the number of hours worked by the wage per hour. If the number of hours worked is over 40, be sure to pay the HourlyWorker for the overtime hours. Add a pointer to an object of each new class into the
![Check Mark](/static/check-mark.png)
Want to see the full answer?
Check out a sample textbook solution![Blurred answer](/static/blurred-answer.jpg)
Chapter 20 Solutions
EBK C HOW TO PROGRAM
Additional Engineering Textbook Solutions
Web Development and Design Foundations with HTML5 (8th Edition)
Starting Out with C++ from Control Structures to Objects (8th Edition)
Java: An Introduction to Problem Solving and Programming (7th Edition)
Starting Out with Python (4th Edition)
Problem Solving with C++ (10th Edition)
Starting Out with C++: Early Objects
- (Time Class Modification) It would be perfectly reasonable for the Time class of Figs. 17.4–17.5 to represent the time internally as the number of seconds since midnight rather than the threeinteger values hour, minute and second. Clients could use the same public methods and get thesame results. Modify the Time class of Fig. 17.4 to implement the time as the number of secondssince midnight and show that there is no visible change in functionality to the clients of the class.[Note: This exercise nicely demonstrates the virtues of implementation hiding.]arrow_forward) Define a struct type to represent a university student with a name, surname, course, year. 2) Define a couple of named instances, e.g., David, Pearl, Computing, Year1. 3) Apply selector function to return the course and year of your student.4) Write a function that updates the year of a student, i.e. if year is “Year1”, then update to “Year2”, if year is “Year2”, then update to “Year3”, if the year is “Year3” then updated to “Graduated”. Make sure to write what the difference between mutable and immutable is.arrow_forward(Modifying Class GradeBook) Modify class GradeBook (Figs. 16.11–16.12) as follows:a) Include a second string data member that represents the course instructor’s name.b) Provide a set function to change the instructor’s name and a get function to retrieve it.c) Modify the constructor to specify course name and instructor name parameters.d) Modify function displayMessage to output the welcome message and course name,then the string "This course is presented by: " followed by the instructor’s name.Use your modified class in a test program that demonstrates the class’s new capabilities.arrow_forward
- (Payroll System Modification) Modify the payroll system of Figs. 20.9–20.17 to includeprivate data member birthDate in class Employee. Use class Date from Figs. 18.6–18.7 to representan employee’s birthday. Assume that payroll is processed once per month. Create a vector of Employee references to store the various employee objects. In a loop, calculate the payroll for each Employee (polymorphically), and add a $100.00 bonus to the person’s payroll amount if the currentmonth is the month in which the Employee’s birthday occurs.arrow_forwardProgramming Exercise C++ Summary During the tax season, every Friday, the J&J accounting firm provides assistance to people who prepare their own tax returns. Their charges are as follows: If a person has low income (<= 25,000) and the consulting time is less than or equal to 30 minutes, there are no charges; otherwise, the service charges are 40% of the regular hourly rate for the time over 30 minutes. For others, if the consulting time is less than or equal to 20 minutes, there are no service charges; otherwise, service charges are 70% of the regular hourly rate for the time over 20 minutes. (For example, suppose that a person has low income and spent 1 hour and 15 minutes, and the hourly rate is $70.00. Then the billing amount is 70.00 X.40 X (45/60) = $21.00.) Instructions Write a program that prompts the user to enter yearly income, the hourly rate, the total consulting time. The program should output the billing amount. Your program must contain a function that takes as…arrow_forwardQuestion 19 (1 point) Listen The primary advantage of static type binding is that it provides programming flexibility. True Falsearrow_forward
- Class exercise (Assignment) • Malek's Pizza Palace has a takeout service. The customer walks in and orders a pizza. The clerk takes the request and calculate the total for the customer. The customer pays for the total. (clerk receive money, customer receives receipt). • (No checking on pizza if it is late) • When clerk receive the money, the clerk send the order to the chef. The chef bakes the pizzaarrow_forward[Assignment 1 - is related to CLO # 2 and 3] CLO-2: Design programs utilizing the principles of object oriented to solve simple computational problems. CLO-3: "Implement object-oriented principles to effectively and efficiently solve computational problems involving multiple objects". Design and implement java program for " Covenant System"; the system stores a covenant name, type and date for each object. Also, each Covenant should have the employee name and ID. The system contains a Covenant class and TestCovenant class. To implement the class, you must: (not exclusively) 1. Make at least one constructor to initialize the object with a Date object and ID. 2. Each private data must have setter and getter method. 3. In the main class you have to create 5 Covenants objects and assign for each object its (name, id, datecreated. Employee name, Employee ID). Submit UML class diagram for the Covenants class with Java codes and screenshot of the output (all in one .docx or PDF file).arrow_forwardClass Work #1 Q1-A) LUTS are used as function generators to implement functions. Use the listed LUT structures to design the Boolean function given below: • 2-input LUTS • 3-input LUTS • 4-input LUTS Boolean function(A, B, C, D) = ABD + BCD + ABC Q1-B) How many 6-T SRAM locations does a k-input LUT have? And how many number of transistors are required (transistor count) ? As follows: > # of NMOS transistors? > # of PMOS transistors? > # of pass (access) transistors? > Bit capacity of the required SRAM cells 0000 10 10 1001 0 1 11 SC input A B Elida EEarrow_forward
- Q3) Write C++ program to create class called home that has data members area, circumference and price, also create a second class called apartment that hase the same data members of class home in addition to floor number and city name,. All classes have a constructor to assign values, and member function to display values. The class home also had a destructor.arrow_forwardProblem Statement: The mathematician Conway imagined a game, called game of life, which considered cells that are susceptible to reproduce, disappear, or survive when they obey certain rules. These cells are represented by elements on a grid of squares, where a grid has an arbitrary size. Thus, each cell (except those on the boundaries of the grid) is surrounded by eight squares that contain other cells. The rules are stated as follows: 1. Survival: Each cell that has two or three adjacent cells survives until the next generation.2. Death: Each cell that has at least four adjacent cells disappears (or dies) by overpopulation. Also, each cell that has at most one adjacent cell dies by isolation.3. Birth: Each empty square (i.e., dead cell) that is adjacent to exactly three cells gives birthto a new cell for the next generation.It is worth noting that all births and deaths occur at the same time during a generation. Write a program that simulates this game and displays all successive…arrow_forwardQ#3)a. Define a class named Movie. Include private fields for the title, year, and name of the director. Include three public functions with the prototypesvoid Movie::setTitle(string);void Movie::setYear(int);void Movie::setDirector(string);Include another function that displays all the information about a Movie.arrow_forward
- C++ for Engineers and ScientistsComputer ScienceISBN:9781133187844Author:Bronson, Gary J.Publisher:Course Technology Ptr
![Text book image](https://www.bartleby.com/isbn_cover_images/9781133187844/9781133187844_smallCoverImage.gif)