Question: please use eclipes Part 1: The Employee Class Download Lab02 EmnlevecPolymornhism.zie and import it into Eclipse. As needed you can reference instructions for importing to

please use eclipes
please use eclipes Part 1: The Employee Class Download Lab02 EmnlevecPolymornhism.zie and
import it into Eclipse. As needed you can reference instructions for importing
to Eclipse: Eclipse imeortpoff =1. For this lab, you are given a
partially-implemented class called Employee. First you will create a test class and
test all of the methods currently in the Employee class. Reference: Writing.

Part 1: The Employee Class Download Lab02 EmnlevecPolymornhism.zie and import it into Eclipse. As needed you can reference instructions for importing to Eclipse: Eclipse imeortpoff =1. For this lab, you are given a partially-implemented class called Employee. First you will create a test class and test all of the methods currently in the Employee class. Reference: Writing. Unit Tests with student Test Case Once all of your tests pass, there's one more method you will need to write for the Employee class the equals miethod. Using what you have learned in the Java OOP module, implement an equals method for the Employee class. Two Employee objects will be considered equal If they have the same name and the same employee ID. Use the method signature below to get started. eOverride public boolean equals(Object obj) Aimplementotion soes here. Once you have written your equals method, test it in the Employectost dass. Refer to your equals method to make suce that you have tested an possibilities Part 2: The PartTimeEmployee Class Some companies have employees that don't work the typical 40 hour work week. However, the part time employees will share some traits with regular employees. Both have a name, for instance, so we want both classes to have the method 'getName' but we don't want to have to write it twice. To represent this, you will create a class called PartimeEmployee, which will extend the Employee class: To do this, go to the Package Explorer window in Eclipse and make sure the project for this lab is selected. In the top left corner, go to File > New > Class. the Name field, type in PartTimeEmployee (no spaces, caps sensitive) then enter "Employee" in the Superclass ficld. Click. Finish. Make sure the PartimeEmployee class extends the Employee class. Yoyi will want to create a test class for PartTimeEmplyee the same way you created a test class for Employee. Create tests for your methods as you write them. The ParttimeEmployee class will have a constructor with four parameters. The first three parameters will match the Employee class' constructor, so be sun to call the parent constructor using super. The fourth parameter is an integer representing the number of hours worked per week. 8e sure to store this value in a feld and then write a getter method for it: public int gethoursWorked0 Next, you will override Employee's weeklypy method, Since PartmineEmployee objects don't work the tynical 40 hour work week, calculate their weekly pay based on their individual number of hours worked per week. (Note that at this cheop company no employee receives time and a haff for overtime J Qoverride public double weeklyPoy0 Note that when using assertEqualsf) on double values, a third parameter for precision is required in addition to the two values being compared. This parameter determines how close two doubles must be to each other to be considered equal. This will look like assertEqualivalue 1, value, 2, 0.1 ) for example. Part 3: The ExternalContractor Class Now you will create a class called ExternalContractor that also extends Employee. Be sure to create a test class for ExternalContractor as well and test your methods as you write them. This class will have a three-parameter constructor, which should be passed through to Employee's constructor. Remember to utilize the information in the UML at the top of the lab. Contractors can either be paid by the project or by hour. Since we can use Employee's gethourlyRate method id the contractor is paid by the hour, we need an overloaded method in the ExtemalContractor class in case he/she is paid by the project. First you will overioad the get Hourhlate method by having it take a single parameter: a char representing the customer rank. A valid customer rank can be 'A: ' B, or ' C. An invalid customer rank would be any char besides 'A: B', or 'C: linvalid char should return $0, Use the guide below to return the correct hourlyfate values: Customer Rank = 'A: Pay rate =$38,50 Customer Rank - 'B'. Pay rate - $41.75 Customer Rank = 'C, Pay rate =$45,50 A note about switch statements: You may choose to write a switch statement instead of an if-else statement for this overloaded get HourlyRate method if youre untamiliar to switch statements, below is an example of equivalent if-else and switch statements: //if-else version if (x=4){ return 44; \} else if (x==5)( return 55; 3 elsel return 0; \} /lequivalent switch statement switch(x) \& case 4: return 44; case 5: return 55; default: return 0; \} Now you will overload the weeklyPay method. Assume that an ExternalContractor works with a particular client on a weekly basis (no switching between projects within a work week). Within that week, the ExternalContractor may work a certain number of hours depending on the demand of the particular job. Therefore, your weeklyPay method will take two parameters: number of hours worked (fint) and the customer rank (char). f"n "The amount paid per week. - Bparam hours The number of hours worked per week. "Eparam custRank The customer's rank (volid for 'A, 'B, 'C) ' Ereturn Returns the amount paid for a certain Yeek. public double weekdy Paylint hours, char custRank) You will want to calculate the weeklypay by calling the overlosded gethourlyRate method you just wrote and pass the correct parameter. Then multiply that value with the number of hours worked and retum the product. A quick note about the difference between overloading and overnding. Overloading occurs when two methods have the same name but have different parameters (resulting in ditferent method signatures). For example a method called add that receives two int parameters would have a signature addint. int). This would be different from a method called add thut receives two double parameters adddouble, doublel. 5 ame method name but different signature. Overiding occurs when we want to change the implenentation of a method inherited from the mperclass: This method would have the same signature as the one inheritad from the parent, ie, has the same name and parameter, but has a different internal inglementation. We use the eovernide tag to Indicare that we are overriding an inherited methns

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!