Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

JAVA: Model this situation using the following classes: an Worker class which the other classes will inherit. You will give a name to each of

JAVA:

image text in transcribed

image text in transcribed

image text in transcribed

Model this situation using the following classes: an Worker class which the other classes will inherit. You will give a name to each of the workers. The name of a worker cannot be changed. The Worker class contains: o an attribute named name of type String for the worker's name. o a constructor which only takes the name of the worker as a parameter. o an accessor (method) getName which must return the name of a worker o a getSalary method which will have to calculate the salary and send back. o a toString method which must display the name and the salary of each worker. a Contract class which contains: 04 named double attributes: nbHours for the number of hours worked per week. -hourRate for the hourly rate. percentHour Sup for the percentage of their hours additional dueHour (static) for the number of hours due per week (40). o 2 constructors: one which only takes the name of the worker as a parameter and the other which takes in parameters the name and all the information for the salary calculation -a modifier (method) setSalaryinfo to enter or modify the raw information needed to calculate salaries (number of working hours, hourly rate, percentage of hours additional). o 3 accessors (methods): getNbHours "getHourRate getPercentHour Sup o a getSalary method (accessor) which will have to calculate the salary . . and send it back. o a toString method which must display the number of hours worked by week, hourly rate and percentage for overtime. a Fulltime class which contains: o 3 attributes of type double: * pay: for the fixed sum paid to workers . turnover: for the monthly turnover percentTurnover: percentage of turnover for the . salary calculation o 2 constructors: one which only takes the name of the worker as a parameter and the other which takes in parameters the name and all the information for the salary calculation. o 3 modifiers (methods): .setSalaryinfo to enter or modify raw information necessary for the calculation of salaries (fixed pay, turnover). - set Turnover - setPay o a method (accessor) getSalary which will have to calculate the salary and send it back. o a toString method which must display the number of hours worked by week, hourly rate and percentage for overtime. A Test class to test your classes, comprising a main () method which will enter information about workers of different types. Workers will be saved in an workers array. At least one of the workers will be created with the constructor who only has the name in parameter, and then you will enter the information for his salary with the setSalaryInfo method. The main method will display the weekly salary of each worker in a "for" loop that will cycle through the worker table. We use polymorphism with the accessor for the salary. /******** Example output ******/ Max earns $ 30000.0 Emily earns $ 20000.0 Michael earns $ 9800.0 Eric has an unspecified pay

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

More Books

Students also viewed these Databases questions

Question

=+2 How can the effectiveness of global virtual teams be improved?

Answered: 1 week ago

Question

=+1 What are the major issues related to international T&D?

Answered: 1 week ago