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
Want to see the full answer?
Check out a sample textbook solutionChapter 20 Solutions
C How to Program (8th Edition)
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
- 1. [LO 1, LO 2, LO 3 & LO 4, Treasure Hunter Description You are in front of a cave that has treasures. The cave can be represented in a grid which has rows numbered from 1 to , and columns numbered from 1 to . For this problem, define (x,y ) as a tile that is in the the-x row and the y-row. There is a character in each tile, which indicates the type of that tile. Tiles can be floors, walls, or treasures which are represented respectively by the characters '.' (period), '#' (hashmark), and '*' (asterisk). You can go through the floor tiles and treasures, but you can't get past the wall tiles.Initially, you are in a tile (??, Sy). You want to visit all the treasure squares, and retrieve the treasure. When you visit a treasure tile, the treasure is instantly retrieved, and the tile turns into a floor.In a move, if you are on a tile (?,y), then you can move to the right tile above (?-1,y), right (?,y + 1), down (? + 1, ), and left (?, 1) of the current tile. The tile you visit must…arrow_forward(Abstract Base Classes) Suggest one or more levels of abstract base classes for the Shape hierarchy discussed in this chapter and shown in Fig. 19.3. (The first level is Shape, and the secondlevel consists of the classes TwoDimensionalShape and ThreeDimensionalShape.)arrow_forward(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
- please solve it, C++arrow_forwardSynchronization (Social Distancing Problem) C++ multithreading At a playground, kids love to play on a play play structure. However, due to an ongoing pandemic, socialdistancing needs to be enforced. There are two types of kids—vaccinated, and non-vaccinated. The vaccinated kids have immunity against the virus hence don’t need social distancing. The non-vaccinated kids needs to maintain social distancing for their safety. The park managers came up with a solution that both the vaccinated and non-vaccinated kids cannot play at the play structure simultaneously.Below is a pseudocode for a solution using semaphores that allows any number of vaccinated kids on the play structure at the same time, but only one non-vaccinated kid. (All the kids are represented as threads.) If a non-vaccinated kid is playing at the structure, no other kid (either vaccinated or nonvaccinated) can be allowed. Any number of vaccinated kids can be at the play structure together. The solution must implement the…arrow_forward26 LAB: Rolling for a pair Given two GVDie objects that represent 2 six-sided dice and an integer that represents a desired value as parameters, complete the function rolling for pair(). The function rolling for pair() rolls the dice until a pair with the desired value is rolled and then returns the number of rolls thrown to achieve the result. Assume the desired value received from input is within the appropriate range, 1-6. Note: For testing purposes, the GVDie objects are created in the main() function using a pseudo-random number generator with a fixed seed value. The program uses a seed value of 15 during development, but when submitted, a different seed value will be used for each test case Ex If the GVDie objects are created with a seed value of 15 and the input of the program is: 3 the output is: It took 13 rolls to get a pair of 3's. 375860 2438106.qx3zay?arrow_forward
- Question 19 (1 point) Listen The primary advantage of static type binding is that it provides programming flexibility. True Falsearrow_forwardIm trying to solve but I'm getting error in my own code. Please help me out. Use jupyter idearrow_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_forward
- Software engineering Question: Q.No.4. The client's ultimate objective is to have an online software system that gives information about the movies that the client sells to customers online. The system gives information about movies and actors/actresses. That is, the system should be accessed online. Each movie is identified by title and year of release. A movie has a genre (drama, comedy, etc.), a running time, and one director. A movie is made at a movie studio and may have multiple producers (people in charge of the movie production). A movie studio has a unique name and address, and may make one or more movies. Producers are identified by name and date of birth and produce one or more movies. Directors are also identified by name and date of birth and direct one or more movies. Assume that directors don’t act or produce movies. Actors are identified by name and date of birth, and may appear in one or more movies. An actor who appears in a movie, has a role. There may…arrow_forwardClass 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_forwardjkvhj,nmarrow_forward
- C++ for Engineers and ScientistsComputer ScienceISBN:9781133187844Author:Bronson, Gary J.Publisher:Course Technology Ptr