Urgent help needed with Java program!
Create necessary classes and a Java application that support the following: Use the Employee class as the base class:
Employee class, which holds following information:
Use Inheritance to create the following additional classes
Provide necessary GUI that supports;
- Display Employee Information
- Search for an Employee
- Add Employee
- Edit Employee Information
class Employee {
private String firstName, lastName, phoneNumber, address, title;
private int id;
private double salary;
public Employee() {
firstName = "";
lastName = "";
phoneNumber = "";
address = "";
title = "";
id = 1;
salary = 0.0;
}
public Employee(String firstName, String lastName, String phoneNumber, String address, String title,
double salary) {
id = 0;
this.firstName = firstName;
this.lastName = lastName;
this.phoneNumber = phoneNumber;
this.address = address;
this.title = title;
this.salary = salary;
}
public Employee(String firstName, String lastName, String phoneNumber, String address, String title, int id,
double salary) {
this.firstName = firstName;
this.lastName = lastName;
this.phoneNumber = phoneNumber;
this.address = address;
this.title = title;
this.id = id;
this.salary = salary;
}
public String getFirstName() {
return firstName;
}
public void setFirstName(String firstName) {
this.firstName = firstName;
}
public String getLastName() {
return lastName;
}
public void setLastName(String lastName) {
this.lastName = lastName;
}
public String getPhoneNumber() {
return phoneNumber;
}
public void setPhoneNumber(String phoneNumber) {
this.phoneNumber = phoneNumber;
}
public String getAddress() {
return address;
}
public void setAddress(String address) {
this.address = address;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public double getSalary() {
return salary;
}
public void setSalary(double salary) {
this.salary = salary;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((address == null) ? 0 : address.hashCode());
result = prime * result + ((firstName == null) ? 0 : firstName.hashCode());
result = prime * result + id;
result = prime * result + ((lastName == null) ? 0 : lastName.hashCode());
result = prime * result + ((phoneNumber == null) ? 0 : phoneNumber.hashCode());
long temp;
temp = Double.doubleToLongBits(salary);
result = prime * result + (int) (temp ^ (temp >>> 32));
result = prime * result + ((title == null) ? 0 : title.hashCode());
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Employee other = (Employee) obj;
if (address == null) {
if (other.address != null)
return false;
} else if (!address.equals(other.address))
return false;
if (firstName == null) {
if (other.firstName != null)
return false;
} else if (!firstName.equals(other.firstName))
return false;
if (id != other.id)
return false;
if (lastName == null) {
if (other.lastName != null)
return false;
} else if (!lastName.equals(other.lastName))
return false;
if (phoneNumber == null) {
if (other.phoneNumber != null)
return false;
} else if (!phoneNumber.equals(other.phoneNumber))
return false;
if (Double.doubleToLongBits(salary) != Double.doubleToLongBits(other.salary))
return false;
if (title == null) {
if (other.title != null)
return false;
} else if (!title.equals(other.title))
return false;
return true;
}
@Override
public String toString() {
return "Employee [firstName=" + firstName + ", lastName=" + lastName + ", phoneNumber=" + phoneNumber
+ ", address=" + address + ", title=" + title + ", id=" + id + ", salary=" + salary + "]";
}
}
NOTE: As per Chegg policy, I am allowed to answer specific number of coding question (including sub-parts) on a single post. Kindly post the remaining questions separately and I will try to answer them. Sorry for the inconvenience caused.
Urgent help needed with Java program! Create necessary classes and a Java application that support the...