Question
count Employee Boss All your classes should be in a single.java file. Write a program that stores employee information. You will have 3 classes: Employee,
count Employee Boss All your classes should be in a single.java file.
Write a program that stores employee information. You will have 3 classes: Employee, Address and Driver Employee class (All variables are private) fName String IName String boss Employee points to an Employee object. addr Address points to an Address object integer stores the total number of employees Since all the variables are private, you must use getter and setter methods to get access to these variables.
The count variable should be incremented through the anonymous instance block
This class will have 3 constructors Constructor 1: Takes 2 arguments: fname, and Iname Constructor 2: Take 3 arguments: fName, IName and boss Constructor 3: Takes 4 arguments: Name, IName, boss and addr Note: Make sure that constructor 2 refers to constructor to populate Name and IName Make sure that constructor 3 refers to constructor 2 to populate Name, IName and boss .
It is possible for an employee to not have a boss, which means the boss is set to null. Address class (All variables are private) city String state String Since all the variables are private, you must use getter and setter methods to get access to these variables. .
This class will have I constructor which takes the city and state Driver class (All variables are local) Grab input from the user to create 3 Employee objects. Use the following variables to point to the objects: empl. emp2, emp3 (do not use arrays, vectors or lists) Grabbing name:
Grab the first name and last name as a single input separated by a space. Separate the name into first name and last name Grabbing address: Grab the city and state as a single input separated by a comma Separate the address into city and state 1* object Use the 1\"' constructor Use setter methods to assign values to other variables Set the boss to null 2nd object Use the 2nd constructor Use setter methods to assign values to other variables Set the boss to the first employee 3rd object Use the 3r constructor Set the boss to the 2nd employee The count variable in the Employee class should only be incremented through the anonymous instance block every time an employee is created. After all the employees are created, display all the information for each employee using the appropriate getter methods. NOTE:
You should call other methods from within main (helper methods) to ensure that your main method is not too big. Your main method should not contain more than 15 lines of code. What to turn in: Single.java file Make sure your program compiles and runs Do not wait until the last minute
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started