Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Hello, I need some assistance in this Java Assignment Write a program that is able to store an employees information. An employee can have a

Hello, I need some assistance in this Java Assignment

image text in transcribed

Write a program that is able to store an employees information. An employee can have a first name,

last name, address and a boss. It is possible for an employee to not have a boss.

Employee class (All variables are private)

fname

String

lname

String

boss

Employee //points to an Employee object.

Addr

Address //points to an Address object

Employee(fname,lname,boss, city, state)

//one constructor

getName()

//returns the concatenated string fname and lname

getAddress()

//returns Address object

setBoss(Employee object)

getBoss()

//returns Employee object

Address class (All variables are private)

city

String

state

String

Address(city,state)

getAddress()

//returns the concatenated string city and state

Driver class

Create two employee objects. You can hardcode the employee data. User input not necessary

For the first employee, there is no boss which means that in the constructor you would

pass in null (Use the keyword null)

For the second employee, the boss will be the first employee;

Display all the employees information. You will assume that you have no idea which

employee has a boss and which does not. So when displaying information, you have to check if the

instance variable, boss, is set to null or not. Only if it is not set to null do you want to display the bosss

information which would be the first name and last name of the boss. If there is no boss, then you dont

display any boss information

Write a program that is able to store an employee's information. An employee can have a first name, last name, address and a boss. It is possible for an employee to not have a boss Employee class (All variables are private) fname Iname boss Addr String String Employee //points to an Employee object. Address //points to an Address object //one constructor Employee(fname,Iname,boss, city, state) getName) getAddress) setBoss(Employee object) getBoss() //returns the concatenated string fname and Iname //returns Address object //returns Employee object Address class (All variables are private) city String state String Address(city,state) getAddress() //returns the concatenated string city and state Driver class Create two employee objects. You can hardcode the employee data. User input not necessary For the first employee, there is no boss which means that in the constructor you would pass in null (Use the keyword null) For the second employee, the boss will be the first employee; Display all the employees' information. You will assume that you have no idea which employee has a boss and which does not. So when displaying information, you have to check if the instance variable, boss, is set to null or not. Only if it is not set to null do you want to display the boss's information which would be the first name and last name of the boss. If there is no boss, then you don't display any boss information Example 1st employee John Jones lives in Sacramento California and boss is null (Does not have a boss) 2nd employee James bond lives in Davis California and his boss is john jones (point to the first employee)

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

Postgresql 16 Administration Cookbook Solve Real World Database Administration Challenges With 180+ Practical Recipes And Best Practices

Authors: Gianni Ciolli ,Boriss Mejias ,Jimmy Angelakos ,Vibhor Kumar ,Simon Riggs

1st Edition

1835460585, 978-1835460580

More Books

Students also viewed these Databases questions