Create an HourlyEmployee class that inherits from Employee and has two new instance variables: hours, which...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Create an HourlyEmployee class that inherits from Employee and has two new instance variables: hours, which represents the hours worked, and wage, which represents the employee's pay per hour. (Both are doubles.) Create a constructor that takes the arguments first name, last name, social security number, hourly wage, and the number of hours worked. Also create accessors, mutators, an earnings method that returns the money earned by the employee this week, and a toString method that returns information about the employee in the form of a String. The setWage method should ensure that the wage is nonnegative, and the setHours method should ensure that the value of hours is between 0 and 168 (the number of hours in a week). Create a Driver class with a main method that prompts the user to enter a first name, last name, social security number, hours, and wage for an employee. Then, the program should create an Hourly Employee object and use its toString method to print information about it. SAMPLE RUN #1: java Driver Interactive Session Hide Invisibles Highlight: None Enter first name: Bobbie Enter last name: Benton Enter social security number: 765-42-0092- Enter hours worked:53 Enter wage:15.8 hourly employee: Bobbi Bentone social security number: 765-42-0092- hours: 53.0. wage: 15.80. earnings: 837.40+ Show Highlighted Only Create an HourlyEmployee class that inherits from Employee and has two new instance variables: hours, which represents the hours worked, and wage, which represents the employee's pay per hour. (Both are doubles.) Create a constructor that takes the arguments first name, last name, social security number, hourly wage, and the number of hours worked. Also create accessors, mutators, an earnings method that returns the money earned by the employee this week, and a toString method that returns information about the employee in the form of a String. The setWage method should ensure that the wage is nonnegative, and the setHours method should ensure that the value of hours is between 0 and 168 (the number of hours in a week). Create a Driver class with a main method that prompts the user to enter a first name, last name, social security number, hours, and wage for an employee. Then, the program should create an Hourly Employee object and use its toString method to print information about it. SAMPLE RUN #1: java Driver Interactive Session Hide Invisibles Highlight: None Enter first name: Bobbie Enter last name: Benton Enter social security number: 765-42-0092- Enter hours worked:53 Enter wage:15.8 hourly employee: Bobbi Bentone social security number: 765-42-0092- hours: 53.0. wage: 15.80. earnings: 837.40+ Show Highlighted Only
Expert Answer:
Related Book For
Java How To Program Late Objects Version
ISBN: 9780136123712
8th Edition
Authors: Paul Deitel, Deitel & Associates
Posted Date:
Students also viewed these programming questions
-
Design a class named Employee. Instance variables: Employee name Employee number in the format XXX-L, where each X is a digit within the range 0-9, and the L is a letter. Hire date Methods:...
-
Other types of Employees might include Salaried-Employees who get paid a fixed weekly salary, PieceWorkers who get paid by the number of pieces they produce or HourlyEmployees who get paid an hourly...
-
A palindrome is a string that is the same backward as it is forward. For example,tot and otto are rather short palindromes. Write a program that lets a user enter a string and that passes to a bool...
-
Why is it difficult to evaluate the regulation question?
-
Fulton National Hospital is reviewing ways of cutting the cost of stocking medical supplies. Two new systems are being considered to lower the hospital's holding and handling costs. The hospital's...
-
Determine the diameter of a red brass C83400 bar that is \(8 \mathrm{ft}\) long if it is to be used to absorb \(800 \mathrm{ft} \cdot \mathrm{lb}\) of energy in tension from an impact loading. No...
-
Schweser Satellites Inc. produces satellite earth stations that sell for $100,000 each. The firms fixed costs, F, are $2 million, 50 earth stations are produced and sold each year, profits total...
-
Part One: Please summarize the five steps required for Metallic Cartridge Reloading. Part Two: What safety precautions are needed as part of the process? Part Three: Finally, describe the best...
-
Your friend is firing a gun, and you want to be a safe distance away, so you walk away until there are 1.2 seconds between the time you see the gunfire, and the time you hear it. You think this still...
-
The sources of electrical power for a region nuclear, fossil, and hydroelectric. The respective generating capacities of these sources can be described as independent Gaussian random variables as...
-
[15 points] What is the value of the following PROC program? let makemult = proc (maker) proc (x) if zero? (x) then 0 else -(((maker maker) -(x,1)), -4) in let times4 = proc (x) ((makemult makemult)...
-
Find the amount of compression occurring in the spring in the horizontal equilibrium position. ? ? Find out with what angular frequency the plank will make a simple harmonic motion. A horizontal...
-
Sketch a ( t ) , V ( t ) , and d ( t ) for a carwhose initial velocity is 1 5 [ m / s ] andremains at 1 5 [ m / s ] for 4 [ seconds ] .
-
Calculate the initial monthly payment for a loan of R40000 payable over 4 years at an interest of 15% if payments between month 12 and 36 are suspended Answers must be rounded to 2 decimal places and...
-
1. Which of the following elements has the largest atomic radius? a. Na b. Ba c. Pb d. Cl e. Ar 2. Which of the following elements has the smallest atomic radius? a. Na b. Ba c. Pb d. Cl e. Ar 3....
-
PC Contractors, Inc., was an excavating business in Kansas City, Missouri. Union Bank made loans to PC, subject to a perfected security interest in its equipment and other assets, including...
-
The dissociation of phosphorus pentachloride takes place at \(250^{\circ} \mathrm{C}\) as \[ \mathrm{PCl}_{5} ightleftharpoons \mathrm{PCl}_{3}+\mathrm{Cl}_{2} \quad K_{P}=1.8 \] Calculate the...
-
The reaction for oxidation of sulphur is given by \[ \mathrm{SO}_{2}(\mathrm{~g})+\frac{1}{2} \mathrm{O}_{2}(\mathrm{~g}) ightarrow \mathrm{SO}_{3}(\mathrm{~g}) \] A mixture of sulphur dioxide and...
-
The thermal decomposition of limestone takes place as \[ \mathrm{CaCO}_{3}(\mathrm{~s}) ightleftharpoons \mathrm{CaO}(\mathrm{s})+\mathrm{CO}_{2}(\mathrm{~g}) \] Calculate the decomposition pressure...
Study smarter with the SolutionInn App