(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. (Standard output) Enter·first·name:Enter·last·name:Enter·social·security·number:Enter·hours·worked:Enter·wage:hourly·employee:·Bobbi·Benton↵ social·security·number:·765-42-0092↵ hours:·53.0·↵ wage:·15.80·↵ earnings:·837.40↵
(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.
(Standard output) Enter·first·name:Enter·last·name:Enter·social·security·number:Enter·hours·worked:Enter·wage:hourly·employee:·Bobbi·Benton↵ social·security·number:·765-42-0092↵ hours:·53.0·↵ wage:·15.80·↵ earnings:·837.40↵
Given data,
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. 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, and 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.
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 5 images