Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribed
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 PartTimeEmployee, which will extend the Employee class: To do this, 80 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. In the Name feld, type in PartTimeEmployee (no spaces, caps sensitivel then enter "Employee" in the Superclass field. Click Finish. Mahe sure the PartTimeEmployee class extends the Employee class. You will want to create a test class for PartTimeEmplyee the same war you created a test class for Employee. Create tests for your methods as you write them. The PartimeEmployee class will have a constructor with four parameters. The first three parameters will match the Employee class' constructor; so be sure to call the parent constructor using super. The fourth parameter is an integer representing the number of hours worked per week. Be sure to store this value in a feld and then write a getter method for it: public int getHoursworked) Next, you will override Employee's weeklyPoy method. Since ParttimeEmployee objects don't work the typical 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 haif for overtime.) eOverride public double weeklypay? Note that when using assertEqualso on double values, a third parameter for precision is required in addition to the two vatuos being compared This parameter determines how close two doubles must be to each other to be considered equal, This will look life assertEqualkivalue, 1, volue 2, o1) for example

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Oracle Database 10g Insider Solutions

Authors: Arun R. Kumar, John Kanagaraj, Richard Stroupe

1st Edition

0672327910, 978-0672327919

More Books

Students also viewed these Databases questions

Question

Explain what is meant by the terms unitarism and pluralism.

Answered: 1 week ago