Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Create an HourlyEmployee class that inherits from Employee and has two new instance variables: hours, which represents the hours worked, and wage, which represents
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
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started