JAVA PROGRAM Create a class EmployeeImp and do the following implement interface EmployeeInterface Define the following attributes: int count and an array variable of type Employee. Write a default constructor and initialize array Employee with the size defined in EmployeeInterface Write a constructor that accepts size of an array as parameter. Create array Employee with the parameter size. Use the diagram attached below as reference for the data members of each class. Note: No need to define interface EmployeeInterface, Employee, HourlyEmployee and CommisionEmployee public interface EmployeeInterface{ int size=20; public boolean add(Employee e); // add either an hourly employee or commission employee public int search(String name); //return the index if the name is existing in the array, if not existing return -1 public void display(); //display the information of the employee with its earnings. public boolean isFull(); //return 1 if array is full, 0 if not public boolean isEmpty(); // return 1 if array is empty, 0 if not public void displayCountEmployee(); //display the number of employee in hourly and commission public Employee delete(String name);// deletes the employee whose name is equal to parameter name } FOR EXAMPLE: TEST: (SEE ATTACHED PHOTO FOR THE RESULT) EmployeeImp e = new EmployeeImp (5); HourlyEmployee h1 = new HourlyEmployee("Yule Josef Ato","Cebu City",23,"Accenture",40, 550.98); HourlyEmployee h2 = new HourlyEmployee("Linc Josef Ato","Talisay City",28,"Alliance",41, 600.00); CommissionEmployee c1 = new CommissionEmployee ("Matt Torcende","Butuan City",27,"Systemscore",40000.0f, 550, 0.10f); CommissionEmployee c2 = new CommissionEmployee ("Ysabelle Fuentes","Cagayan de Oro City",29,"EagleBytes",48000.0f, 650, 0.20f); HourlyEmployee h3= new HourlyEmployee("Aya Sanchez","Surigao City",50,"CIT"); e.add(h1); e.add(h2); e.add(c1); e.add(c2); e.add(h3); e.delete("Aya Sanchez"); e.delete("andrew"); e.displayCountEmployee();
JAVA PROGRAM
Create a class EmployeeImp and do the following
- implement interface EmployeeInterface
- Define the following attributes: int count and an array variable of type Employee.
- Write a default constructor and initialize array Employee with the size defined in EmployeeInterface
- Write a constructor that accepts size of an array as parameter. Create array Employee with the parameter size.
Use the diagram attached below as reference for the data members of each class.
Note: No need to define interface EmployeeInterface, Employee, HourlyEmployee and CommisionEmployee
public interface EmployeeInterface{
int size=20;
public boolean add(Employee e); // add either an hourly employee or commission employee
public int search(String name); //return the index if the name is existing in the array, if not existing return -1
public void display(); //display the information of the employee with its earnings.
public boolean isFull(); //return 1 if array is full, 0 if not
public boolean isEmpty(); // return 1 if array is empty, 0 if not
public void displayCountEmployee(); //display the number of employee in hourly and commission
public Employee delete(String name);// deletes the employee whose name is equal to parameter name
}
FOR EXAMPLE:
TEST: (SEE ATTACHED PHOTO FOR THE RESULT)
EmployeeImp e = new EmployeeImp (5);
HourlyEmployee h1 = new HourlyEmployee("Yule Josef Ato","Cebu City",23,"Accenture",40, 550.98);
HourlyEmployee h2 = new HourlyEmployee("Linc Josef Ato","Talisay City",28,"Alliance",41, 600.00);
CommissionEmployee c1 = new CommissionEmployee ("Matt Torcende","Butuan City",27,"Systemscore",40000.0f, 550, 0.10f); CommissionEmployee c2 = new CommissionEmployee ("Ysabelle Fuentes","Cagayan de Oro City",29,"EagleBytes",48000.0f, 650, 0.20f); HourlyEmployee h3= new HourlyEmployee("Aya Sanchez","Surigao City",50,"CIT");
e.add(h1);
e.add(h2);
e.add(c1);
e.add(c2);
e.add(h3);
e.delete("Aya Sanchez");
e.delete("andrew");
e.displayCountEmployee();
![PERSON
String name
String address
int age
Person()
Person(name,address,age)
toString()
equals(Object e)
display()
EMPLOYEE
String companyName
Employee()
Employee(name,address,age, companyName)
toString()
equals(Object e)
display()
abs
act double earnings()
COMMISSIONEMPLOYEE
HOURLYEMPLOYEE
float regularSalary
int itemSold
int hoursWorked
double rate
float commison_rate
HourlyEmployee()
CommissionEmployee()
HourlyEmployee (name,address,age, companyName, hoursWorked, rate)
toString()
equals(Object e)
double earnings()
regularSalary,
CommissionEmployee(name,address,age,
commission_rate)
toString()
companyName,
itemSold,
equals(Object e)
double earnings()](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2Fb7bda6dc-5fd7-42c5-9060-21c9690360fd%2F95cbf940-2842-4043-8bdb-2315c41d7651%2F1kvue8u_processed.png&w=3840&q=75)
![Result
Deleted employee
Name: Aya Sanchez
Address: Surigao City
Age: 50
Company Name: CIT
Hours worked: 0
Rate: 0.0
No such record.andrew
Number of Hourly Employee: 2
Number of Commission Employee: 2](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2Fb7bda6dc-5fd7-42c5-9060-21c9690360fd%2F95cbf940-2842-4043-8bdb-2315c41d7651%2Fn64fky_processed.png&w=3840&q=75)
![](/static/compass_v2/shared-icons/check-mark.png)
Trending now
This is a popular solution!
Step by step
Solved in 2 steps
![Blurred answer](/static/compass_v2/solution-images/blurred-answer.jpg)
![Computer Networking: A Top-Down Approach (7th Edi…](https://www.bartleby.com/isbn_cover_images/9780133594140/9780133594140_smallCoverImage.gif)
![Computer Organization and Design MIPS Edition, Fi…](https://www.bartleby.com/isbn_cover_images/9780124077263/9780124077263_smallCoverImage.gif)
![Network+ Guide to Networks (MindTap Course List)](https://www.bartleby.com/isbn_cover_images/9781337569330/9781337569330_smallCoverImage.gif)
![Computer Networking: A Top-Down Approach (7th Edi…](https://www.bartleby.com/isbn_cover_images/9780133594140/9780133594140_smallCoverImage.gif)
![Computer Organization and Design MIPS Edition, Fi…](https://www.bartleby.com/isbn_cover_images/9780124077263/9780124077263_smallCoverImage.gif)
![Network+ Guide to Networks (MindTap Course List)](https://www.bartleby.com/isbn_cover_images/9781337569330/9781337569330_smallCoverImage.gif)
![Concepts of Database Management](https://www.bartleby.com/isbn_cover_images/9781337093422/9781337093422_smallCoverImage.gif)
![Prelude to Programming](https://www.bartleby.com/isbn_cover_images/9780133750423/9780133750423_smallCoverImage.jpg)
![Sc Business Data Communications and Networking, T…](https://www.bartleby.com/isbn_cover_images/9781119368830/9781119368830_smallCoverImage.gif)