Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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

Datacasting How To Stream Databases Over The Internet

Authors: Jessica Keyes

1st Edition

007034678X, 978-0070346789

More Books

Students also viewed these Databases questions