Question: Java programming Do the same question with List Array Q4. Write a method named listOfWorkers , that will get an TREE MAP array of object

Java programming Do the same question with List Array

Q4. Write a method named listOfWorkers, that will get an TREE MAP array of object (named as map_workers) of class Worker.

Your method should display all workers details come with that array as a formatted list (as a table with rows and columns).

!!! Do not forget to display the header part (Field names as the titles of the columns) .

Solution:

public static void listOfWorkers(Map map_workers) {

System.out.printf(" %3s %10s %10s %7s",

"Id.", "Name", "Position", "Salary");

for (Map.Entry entry: map_workers.entrySet()) {

System.out.printf(" %3s %10s %10d %5.2f",

entry.getValue().get_woid(),

entry.getValue().get_woname(),

entry.getValue().get_wopos(),

entry.getValue().get_wosalary());

}

}

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!