Question: Language: Java Create an HourlyEmployee class that inherits from Employee and has two new instance variables : hours, which represents the hours worked, and wage,

Language: Java

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 HourlyEmployee object and use its toString method to print information about it.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!