Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please help with department class in java Department Methods Description: setName (String): Sets the name of the department. getName(): Returns the name of the department.

Please help with department class in java

Department Methods Description:

setName (String): Sets the

name

of the department.

getName(): Returns the

name

of the department.

getEmployees(): Returns the list of

employees

of a department.

addEmployee(Employee): Adds an

Employee

object to the

employees

of a department.

addEmployee(Name, double, int): An overloaded version enables the addition of a new

Employee

to a department

employees

list.

getEmployee(int): Returns the

Employee

object located at the received index through the

integer parameter.

printEmployee(int ): Prints the information of the

Employee

object located at the received index

through the integer parameter.

printAllEmployees(): Prints the information of all the

Employee

objects in

employees

of a

department.

removeEmployee(int): Removes the

Employee

object located at the received index through the

integer parameter from

employees

.

removeEmployee(Name): Overloaded version that removes

all

employees who have a

Full

name

equals

to the parameter.

3 |

Page

getEmployeeWithMaxSalary(): Returns the

Employee

object who has the

maximum

Salary

.

searchEmpByLastName(String): Returns list of employees who their

last

names equal the

parameter.

clear(): Removes all

Employee

objects from

employees.

Department ( ): The default constructor that initializes the fields to default values.

Department( String): An overloaded constructor that initializes the

name

by the parameter.

Employee Methods Description:

You must apply information validation where the salary and age have to be greater than or

equal their corresponding minimum values.

MINIMUM_AGE: A constant field represents the minimum employees

age

allowed in the

department policies, and it equals 18.

MINIMUM_SALARY: A constant field represents the minimum employees

salary

allowed in the

department policies, and it equals 5000.0 CAD.

setName, setSalary, setAge: Sets the corresponding field value

.

getName, getSalary, getAge: Returns the corresponding field value.

Print: prints all the fields as below:

Employee name: David Li

Salary: 11000.5 CAD, Age: 45 Years.

Employee(): The default constructor initializes all the objects fields to neutral values.

Employee(Name, int, double): An overloaded constructor initializes the object fields by using the

corresponding parameters.

Name Methods Description:

setFirstName (String): Sets the first name.

setLastName (String): Sets the last name.

getFirstName(): Returns the first name.

getLastName(): Returns the last name.

equals(Name): A

Boolean

function returns

true

if the calling object and the passed object

full

names are equal, else it returns

false

.

print( ): Returns a String contains the full name (first and last name).

Name( ): The default constructor initializes the fields by default values.

Name(String, String): An overloaded constructor initializes the fields by the corresponding

parameters.

4 |

Page

In the Main Class:

In the

main

method:

a.

Declare an object of type

Department

called Development.

b.

Add the below

Employee

s to the

Department

object.

c.

Print all employees information in the Department object.

d.

Remove all the employees from the Department object.

e.

Re-print all the employees information in the Department object.

f.

Re-add the previous employees objects to the Department object.

g.

Re-print the all Employees information in the Department object.

h.

Print the first name

only

of the first employee in the employees list of the department

object.

i.

Find and print the information of all employees who have a last name equals to

Power.

j.

Print the information of the employee who have the maximum salary.

k.

Remove the employee who has the name dana lions from the employees list of the

Department object.

l.

Re-print all the Employees information in the Department object.

m.

Print the total number of the created Employee objects so far. Hint: You may need to

add additional members to one of the classes.

n.

Using Lambdas find the answer of the below queries and print the results:

i.

What is the total of salaries of employees their last name is power?

ii.

What is the average employees age in the department?

iii.

What are the first names of all employees in the department?

See the sample run on the next pages

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

Oracle RMAN For Absolute Beginners

Authors: Darl Kuhn

1st Edition

1484207637, 9781484207635

More Books

Students also viewed these Databases questions

Question

If mTA = 42 and mMI = 130, find m/C. C A T M

Answered: 1 week ago