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
System.out.printf(" %3s %10s %10s %7s",
"Id.", "Name", "Position", "Salary");
for (Map.Entry
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
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