Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Example: public static void main(String args[]){ Employee e1 = new Employee(... Department d1 = new Department(... Question 1 Define a class called Employee that has

image text in transcribed

Example:

public static void main(String args[]){

Employee e1 = new Employee(...

Department d1 = new Department(...

Question 1 Define a class called Employee that has the following (private attributes: ppsNum, name, & salary. which are types String, String & double respectively. Include a constructor to take in values to set the attributes Write getter and setter methods for all 3 attributes in the Employee class. Also write a display method for the Employee class which will displays the Employee details in a clear and aesthetically pleasing manner. Be sure to separate the display with blank lines and a header line Define a class called Department that has the following (private) attributes: deptName, manager & office number which are types String, Employee & int respectively Write 2 constructors, one to take in and set the 3 attributes and one to take in the deptName & manager and set the office number to -. Be sure to make defensive copies of object/reference type attributes so as not to break encapsulation (Employee) Write setter methods for the attributes in the Department class. Again be sure to return defensive copies of all object/reference type attributes Also write a display method for the Department class which will display the Department details in a clear and aesthetically pleasing manner. Be sure to separate the display with blank lines and a header line In your test class create Department objects. You will need to create an Employee object first. Display the Employee detail:s Display the department details . Change the values in the Employee object Display the Department details again (The information should not change) Again display the Employee details (The information should be changed her If this is done correctly Department is a fully encapsulated Class as the attributes cannot be changed from outside the class once they have been set in the constructor

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

Automating Access Databases With Macros

Authors: Fish Davis

1st Edition

1797816349, 978-1797816340

More Books

Students also viewed these Databases questions

Question

Practice mobile reach in order to meet marketing goals.

Answered: 1 week ago

Question

5. Discuss the role of the Web in career management.

Answered: 1 week ago