Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Create a class called Employee and model a 'Has-a relationship between Employee and its components, as specified in the UML: Please refer to video Module

image text in transcribedimage text in transcribed

Create a class called Employee and model a 'Has-a" relationship between Employee and its components, as specified in the UML: Please refer to video Module 2_12 that explains composition in class Employee -fName String -IName: String -emplD: int plnfo Personallnfo -comp Compensation -dept Department Also include a double parameter in this Constructor. This double will be the value of pay for compensation object +Employee) +Employee(String, String, int String, String, int, char, String, String +getFName0: String +getLName0: String +getEmplDO: int +getPInfo: Personallnfo +getComp0: Compensation +getDept: Department +setFName(String): void +setLName(String): void +setEmplD(int): void +setPInfo(Personallnfo): void +setComp(Compensation): void +setDept(Department): void +printEmployee0:void type: cha pay double dob String phone: String getTypel: char Personalintol String, String, int +getPay0: double +getDobO: String setType[charj:vold getSsn0: int setDobl Stringi:void name String phone: String DepartmentString, String) getNamek String getPhonel String setNamStringkvoid The closses with their instance variobles, constructors, getters and setters are shown in the UML diagram. The griatmalaxee method prints all the instance variables of the Employee object gnd alsg the instonce variables of its constituentPenafe, Department and Compensotion objects. a) Write the following class as per the UML design Employee, Rersonallnfe Compensation and Department. b) Then write a TestEmnloyee class that does the following c) Create a default Employee object emp1 d) Obtain and set the values of instance variables fName. IName and emplD by using the respective setters e) Create the component object of the type Persanallnfe. To do this get the values of dob phone and ssn from the user. Use the full arg-constructor of Personallnfe to create an object of this class. Use this newly created Personalunfe object as the parameter of the setRlnfe method of the emp1 object. Follow the procedure as described in step e) to create the Department object and use this object as the parameter of the setDept method for emp1 object. f) g) Follow the procedure simlar t what is described in step e). Obtain the values of instance variables from the user, for the Compensation object. Create the Compensation object and use this object as the parameter of the setCompensation method for emp1 object. h) Call the printEmploee method for emp1 i) Create a full-arg, Employee object emp2. Use the same user values that you obtained in steps d), eL f and g). You do not need to obtain these values again from the user j) Call the printEmplovee method for emp2, to print out all these values. Copy paste the code for each class here. Also submit all your source code files

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

Google Analytics 4 The Data Driven Marketing Revolution

Authors: Galen Poll

2024th Edition

B0CRK92F5F, 979-8873956234

More Books

Students also viewed these Databases questions

Question

What is a marketing plan? What lies at its center?

Answered: 1 week ago

Question

Connect with your audience

Answered: 1 week ago