0% found this document useful (0 votes)
21 views2 pages

IPA10

The document outlines the creation of an Employee class with private attributes and necessary methods, including getters, setters, and a parameterized constructor. It also describes a MyClass with static methods to count employees using company transport in a specific branch and to find the employee with the second highest rating who does not use company transport. The main method is designed to read employee data and branch input, and print the results based on the methods' outputs.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
21 views2 pages

IPA10

The document outlines the creation of an Employee class with private attributes and necessary methods, including getters, setters, and a parameterized constructor. It also describes a MyClass with static methods to count employees using company transport in a specific branch and to find the employee with the second highest rating who does not use company transport. The main method is designed to read employee data and branch input, and print the results based on the methods' outputs.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

Create a class called Employee with the below attributes:

employeeld - int
name - String
branch - String
rating - double
company Transport - boolean
The above attributes should be private. write getters, setters and parameterized
constructor as required.

Create class MyClass with main method.


Implement two static methods findCountOfEmployeesUsingCompTransport and
findEmployeeWithSecondHighestRating
in MyClass class.

findCountOfEmployeesUsingCompTransport method:
----------------------------------------------
This method will take an array of Employee object and a String parameter as input
parameters.
This method will calculate and return the count of Employees who are all using
company transport
in the given branch (String parameter passed).
If no Employee in the given branch using company transport in the array of Employee
objects, then
the method should return 0.

findEmployeeWithSecondHighestRating method:
--------------------------------------------
This method will take an array of Employee objects as an input parameter. This
method will return
the object of the second highest rating employee from the array of Employee objects
who are not using
company transport.
If all Employees using company transport in the array of Employee objects, then the
method should return null.

Note: All the searches should be case sensitive, companyTransport and rating
combination of each Employee
is unique.
For findCountOfEmployeesUsingCompTransport method, The main method should print the
returned count as it
is if the returned value is greater than 0, else it should print "No such
Employees".
Ex: 2 , where 2 is the count
For findEmployeeWithSecondHighestRating method: The main method should print the
employeeld and name from
the returned object if the returned value is not null. If the returned value is
null, then it should
print "All Employees using company transport".
Ex: 1003
Uma
where 1003 is the employeeld and Uma is the name.
Before calling these static methods in main, use Scanner object to read the values
of four Employee
objects referring attributes in the above mentioned attributes sequence. Next, read
the value of String
parameter for capturing branch.

Input :
1001
Ashwa
IT
5
true
1002
Preeti
IT
4
true
1003
Uma
Admin
3
false
1004
Akash
Hardware
4.5
false
IT

Output :

2
1003
Uma

You might also like