Question: using java 4) Person class has the following properties:- Person(Integer id, String name, Float salary) Create a PersonService class:- a) List generateList() - This method

using java

4) Person class has the following properties:-

Person(Integer id, String name, Float salary) Create a PersonService class:- a) List generateList() - This method should create a list of Person objects. Use any arbitrary data.

b) Map transform(List people) - This method takes as input the List in the previous step and converts it to a Map. The key (integer) should be the Person.id. If two or more Person objects in the List has duplicate ids, then before Inserting in the Map, then append one on the decimal side. e.g. PersonA - 1, ankur, 20000 : Map<1, Person(1, ankur, 20000)> PersonB - 1, ravi, 30000 : Map<1.1, Person<1, ravi, 30000)> PersonC - 1, prem, 50000: Map<1.11, Person,1,50000>

c) show(List) - prints the Person list on the console in readable format.

d) show(Map - prints the Person map on the console in readable format.

e) Write JUnit tests. Coverage should be atleast 70%.


Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!