Create a class Employee. Your Employee class should include the following attributes: First name (string) Last name (string) Employee id (string) Employee home street address (string) Employee home city (string) Employee home state (string) Write a constructor to initialize the above Employee attributes. Create another class HourlyEmployee that inherits from the Employee class. HourEmployee must use the inherited parent class variables and add in HourlyRate and HoursWorked. Your HourEmployee class should contain a constructor that calls the constructor from the Employee class to initialize the common instance variables but also initializes the HourlyRate and HoursWorked. Add an earnings method to HourlyEmployee to calculate the earnings for a week. Note that earnings is hourly rate * hours worked. Create a test class that prompts the user for the information for two hourly employees, creates the 2 two hourly employees objects, calls the earnings method then displays the attributes and earnings for each of the two hourly. Remember to submit all your .java files, .class files and screenshots of your code and output.
import java.util.Scanner;
class Employee {
private String firstName;
private String lastName;
private String id;
private String street;
private String city;
private String state;
public Employee() {
}
public Employee(String aFirstName, String
aLastName, String aId, String aStreet, String aCity, String aState)
{
super();
firstName = aFirstName;
lastName = aLastName;
id = aId;
street = aStreet;
city = aCity;
state = aState;
}
public String getFirstName() {
return firstName;
}
public void setFirstName(String aFirstName) {
firstName = aFirstName;
}
public String getLastName() {
return lastName;
}
public void setLastName(String aLastName) {
lastName = aLastName;
}
public String getId() {
return id;
}
public void setId(String aId) {
id = aId;
}
public String getStreet() {
return street;
}
public void setStreet(String aStreet) {
street = aStreet;
}
public String getCity() {
return city;
}
public void setCity(String aCity) {
city = aCity;
}
public String getState() {
return state;
}
public void setState(String aState) {
state = aState;
}
@Override
public String toString() {
return "FirstName : " + firstName +
"\nLastName : " + lastName + "\nId : " + id + "\nStreet : " +
street
+ "\nCity : " + city + "\nState : " +
state;
}
}
class HourlyEmployee extends Employee {
int hoursWorked;
double hourRate;
public HourlyEmployee() {
}
public HourlyEmployee(String aFirstName, String
aLastName, String aId, String aStreet, String aCity, String
aState,
int
aHoursWorked, double aHourRate) {
super(aFirstName, aLastName, aId,
aStreet, aCity, aState);
hoursWorked = aHoursWorked;
hourRate = aHourRate;
}
// returns earnings for that employee
public double earnings() {
return hourRate *
hoursWorked;
}
public int getHoursWorked() {
return hoursWorked;
}
public void setHoursWorked(int aHoursWorked)
{
hoursWorked = aHoursWorked;
}
public double getHourRate() {
return hourRate;
}
public void setHourRate(double aHourRate) {
hourRate = aHourRate;
}
public String toString() {
return super.toString() + "\nHours
Worked : " + hoursWorked + "\nPay Rate : " + hourRate + "\nEarnings
: "
+ earnings();
}
}
public class TestEmp {
public static void main(String[] args) {
Scanner sc = new
Scanner(System.in);
System.out.println("Enter emp1
first name");
String fname = sc.nextLine();
System.out.println("Enter emp1 last
name");
String lname = sc.nextLine();
System.out.println("Enter emp1
Id");
String id = sc.nextLine();
System.out.println("Enter emp1
street");
String street =
sc.nextLine();
System.out.println("Enter emp1
City");
String city = sc.nextLine();
System.out.println("Enter emp1
state");
String state = sc.nextLine();
System.out.println("Enter Emp1
hours and hour rate");
int hours = sc.nextInt();
double rate =
sc.nextDouble();
HourlyEmployee h1 = new
HourlyEmployee(fname, lname, id, street, city, state, hours,
rate);
sc.nextLine();
System.out.println("Enter emp2
first name");
fname = sc.nextLine();
System.out.println("Enter emp2 last
name");
lname = sc.nextLine();
System.out.println("Enter emp2
Id");
id = sc.nextLine();
System.out.println("Enter emp2
street");
street = sc.nextLine();
System.out.println("Enter emp2
City");
city = sc.nextLine();
System.out.println("Enter emp2
state");
state = sc.nextLine();
System.out.println("Enter emp2
hours and hour rate");
hours = sc.nextInt();
rate = sc.nextDouble();
sc.close();
HourlyEmployee h2 = new
HourlyEmployee(fname, lname, id, street, city, state, hours,
rate);
System.out.println("Employee 1
earnings : " + h1);
System.out.println("Employee 2
earnings : " + h2);
}
}

Note : Please comment below if you have concerns. I am here to help you
If you like my answer please rate and help me it is very Imp for me
Create a class Employee. Your Employee class should include the following attributes: First name (string) Last...
Create an abstract class Employee. Your Employee class should include the following attributes: First name (string) Last name (string) Employee id (string) Employee home street address (string) Employee home city (string) Employee home state (string) Write a constructor to initialize the above Employee attributes. Create an abstract method called earnings. Create another class HourlyEmployee that inherits from the abstract Employee class. HourEmployee must use the inherited parent class variables and add in attributes HourlyRate and HoursWorked. Your HourEmployee class should...
Create an abstract class Employee. Your Employee class should include the following attributes: First name (string) Last name (string) Employee id (string) Employee home street address (string) Employee home city (string) Employee home state (string) Write a constructor to initialize the above Employee attributes. Create an abstract method called earnings. Create another class HourlyEmployee that inherits from the abstract Employee class. HourEmployee must use the inherited parent class variables and add in attributes HourlyRate and HoursWorked. Your HourEmployee class should...
In Java Create a class Worker. Your Worker class should include the following attributes as String variables: Name, Worker ID, Worker Address, Worker City, Worker State Create the constructor that initializes the above worker attributes. Then make another class name HourlyWorker that inherits from the Worker class. HourlyWOrker has to use the inherited parent class variables and add in hourlySalary and billableHours. Your HourlyWorker class should contain a constructor that calls the constructor from the Worker class to initialize the...
Create the Employee class: The Employee class has three attributes: private: string firstName; string lastName; string SSN; The Employee class has ▪ a no-arg constructor (a no-arg contructor is a contructor with an empty parameter list): In this no-arg constructor, use “unknown” to initialize all private attributes. ▪ a constructor with parameters for each of the attributes ▪ getter and setter methods for each of the private attributes ▪ a method getFullName() that returns the last name, followed by a...
Java
Problem 2: Employee (10 points) (Software Design) Create an abstract class that represents an Employee and contains abstract method payment. Create concrete classes: SalaryEmployee, CommissionEmployee, HourlyEmployee which extend the Employee class and implements that abstract method. A Salary Employee has a salary, a Commision Employee has a commission rate and total sales, and Hourly Employee as an hourly rate and hours worked Software Architecture: The Employee class is the abstract super class and must be instantiated by one of...
Within c++ Create a simple Employee class with name, department, and title. Create an hourlyEmployee class (which inherits from the Employee class) for a basic payroll program to compute the net pay salary of hourly based employees. Your program should also find the average net pay for a small company. To define the class, include the appropriate data members, member functions, constructors, and access modifiers. For simplicity, use a constant tax rate of 30% to compute the tax amount. Employees...
In Java Kindly be sure to take in user input and store the 3 worker classes in an ArrayList Create a class Worker. Your Worker class should include the following attributes as String variables: Name, Worker ID, Worker Address, Worker City, Worker State Create the constructor that initializes the above worker attributes. Then make another class name HourlyWorker that inherits from the Worker class. HourlyWorker has to use the inherited parent class variables and add in hourlySalary and billableHours. Your...
The object class should be a Student with the following attributes: id: integer first name: String last name: String write the accessors, mutators, constructor, and toString(). In your main test class you will write your main method and do the following things: Create an array of Student objects with at least 5 students in your array. Write a sort method that must be your original work and included in the main class. The sort method will sort based on student...
in c++
Define and implement the class Employee with the following requirements: private data members string type name a. b. double type hourlyRate 2. public member functions a. default constructor that sets the data member name to blank"and hourlyRate to zero b. A constructor with parameters to initialize the private data members c. Set and get methods for all private data members d. A constant method weeklyPay() that receives a parameter representing the number of hours the employee worked per...
python code? 1. Create a class called Person that has 4 attributes, the name, the age, the weight and the height [5 points] 2. Write 3 methods for this class with the following specifications. a. A constructor for the class which initializes the attributes [2.5 points] b. Displays information about the Person (attributes) [2.5 points] c. Takes a parameter Xage and returns true if the age of the person is older than Xage, false otherwise [5 points] 3. Create another...