Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In our company, generally staff members have an ID number, name and address. An ID numbers is unique regardless of the staff location and is

image text in transcribedimage text in transcribed

"In our company, generally staff members have an ID number, name and address. An ID numbers is unique regardless of the staff location and is automatically generated once a new staff is employed. In addition, unless otherwise specified, a new staff is paid a flat-rate which is decided at the time of employment. Part-time staff do not pay taxes but are issued a maximum number of hours of work and are paid an addition to their flat-rate if they work more hours than the maximum specified. Seasonal staff have an income tax rate and are paid weekly and must have a season description assigned such as Easter, Christmas or Summer. Managers have a division of responsibility and a team size. Managers are paid a monthly salary, but pay no taxes. A Contractor is a special type of PartTime staff. Contractors must have a company from which they provide their contracted service and a phone number." Upon preliminary review, your senior developer thinks strongly that the following classes are the minimum necessary set required to design an appropriate solution: Staffmember, PartTime, Contractor, Seasonal, DivManager. a. Sketch a UML class diagram that models this system. Marks will be allocated as follows: i. Appropriate attributes and Encapsulation (visibility modifiers) [4 marks] ii. Use of inheritance [2 marks] iii. Class relationships (aggregation, composition, etc) [1 marks] b. Write the Java code based on your UML specified in part (a) for the following: i. The Staffmember class with appropriate getters and setters and a constructor to initialize all instance variables. [6 marks] ii. A tostring () method to format and output each attribute in the Staf fmember class with an appropriate label. Each attribute should be on a separate line. [2 marks] iii. A pay () method in the Staffmember class based on the description of how new staff is paid. This method should return a double which represents the payment for the staff. [2 marks] iv. The Contractor class with a constructor to initialize all instance variables (assume all child or parent classes have a constructor to initialize all their instance variables). [3 marks] v. A tostring0 method in the Contractor class to show the Contractor's full details including name and ID number, each printed on a separate line. [2 marks] c. Write Java code fragments to accomplish the following: i. Create an array to store a maximum of 10 Staffmembers. [1 mark] ii. Add four (4) Staffmembers to the array as folluws: 1 DivManager, 1 Contractor, 2 PartTime. [2 marks] iii. Write a loop which will show the payment made to e ich Staffmember in the array (assume the array has now been populated with additional staff from part vii above) [3 marks] d. Based on the code written in parts a-c above, give one example of each of the following: i. Polymorphism [1 mark] ii. Method overriding / method overloading (indicats which) [1 mark]

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

Database Driven Web Sites

Authors: Joline Morrison, Mike Morrison

2nd Edition

? 061906448X, 978-0619064488

More Books

Students also viewed these Databases questions

Question

3. What may be the goal of the team?

Answered: 1 week ago

Question

Is how things are said consistent with what is said?

Answered: 1 week ago