Elass Worker { private static String woid; private static String woname; private static int wopos; private static float wosalary: public void set wosalary(float salary) { wosalary=salary; } public static String get woid() { return woid: } public static String get woname() { public void set woid(String id) { woid=id; return woname; } public static int get wopos) { public void set woname(String name) { return wopos; } woname=name; public void set woposlint ipos) { wopos-ipos; public static float get wosalary) { return wosalary, } } 1. (MT-2 Fall 2012) • Write a method named "read workers" that will get a ListArray of objects (class Worker) as an argument (named workerlist). Your function has to ask user the worker Id, Worker Name, Worker position, and Worker salary, and save these input as the properties of an object which has to be inserted into the workerlist. • On every end of the input turn, your method has to ask user as "Would you like to input for one more worker? (Y/N}". On choise "Y" or "y", it has to read the next worker data. plution: ublic static void read workers(List workerlist){ Worker worker: char ch='N"; do worker = new Worker(); worker.set woidJOptionPane showlnoutDialog("Enter The Worker Id")); worker.set woname(JOptionPane.showlinputDialog("Enter The Worker Name")); worker set wopos(integer.parselnt(JOptionPane.showlnputDialog( "Enter The Worker Position")); worker.set_wosalary(Float.parseFloat(JOptionPane.showlnputDialog( "Enter The Worker Salary")); workerlist.add(worker); ch=JOptionPane.showlnputDialog("Would you want to input one more worker?(Y/N)"); //??? } while ((ch=="Y)|I(ch=="y'));

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

Try to do the same question with Map Array 

public void set wosalarylfloat salary) {
wosalary-salary;
}
public static String get woid() {
return woid:
}
public static String get wonamel) {
class Worker {
private static String woid;
private static String woname;
private static int Wopos;
private static float wosalary;
public void set woid(String id) {
woid=id;
}
public void set woname(String name) {
return woname;
}
public static int get wopos() {
woname=name;
return wopos;
}
}
public void set woposlint ipos) {
public static float get wosalary0 {
return wosalary;
}
}
wopos=ipos;
}
Q1. (MT-2 Fall 2012)
• Write a method named "read workers" that will get a ListArray of objects (class Worker) as
an argument (named workerlist).
Your function has to ask user the worker Id, Worker Name, Worker position, and Worker
salary, and save these input as the properties of an object which has to be inserted into the
workerlist.
• On every end of the input turn, your method has to ask user as "Would you like to input for
one more worker? (Y/N)". On choise "Y" or "y", it has to read the next worker data.
Solution:
public static void read workers(List workerlist){
Worker worker char ch='N';
do {|
worker = new Worker();
worker set woidlJOptionPane showlnputDialog("Enter The Worker Id"));
worker set wonamelJOptionPane.showlnputDialog("Enter The Worker Name"));
worker set wopos lnteger.carselnt(JOptionPane.showlnputDialog(
"Enter The Worker Position")):
worker.set_wosalary(Float.parseFloat(JOptionPane.showlnputDialog(
"Enter The Worker Salary")):
workerlist.add(worker);
ch=JOptionPane.showlnputDialog("Would you want to input one more worker?(Y/N)"); //???
} while ((ch=='Y")|(sh=='y'));
}
Transcribed Image Text:public void set wosalarylfloat salary) { wosalary-salary; } public static String get woid() { return woid: } public static String get wonamel) { class Worker { private static String woid; private static String woname; private static int Wopos; private static float wosalary; public void set woid(String id) { woid=id; } public void set woname(String name) { return woname; } public static int get wopos() { woname=name; return wopos; } } public void set woposlint ipos) { public static float get wosalary0 { return wosalary; } } wopos=ipos; } Q1. (MT-2 Fall 2012) • Write a method named "read workers" that will get a ListArray of objects (class Worker) as an argument (named workerlist). Your function has to ask user the worker Id, Worker Name, Worker position, and Worker salary, and save these input as the properties of an object which has to be inserted into the workerlist. • On every end of the input turn, your method has to ask user as "Would you like to input for one more worker? (Y/N)". On choise "Y" or "y", it has to read the next worker data. Solution: public static void read workers(List workerlist){ Worker worker char ch='N'; do {| worker = new Worker(); worker set woidlJOptionPane showlnputDialog("Enter The Worker Id")); worker set wonamelJOptionPane.showlnputDialog("Enter The Worker Name")); worker set wopos lnteger.carselnt(JOptionPane.showlnputDialog( "Enter The Worker Position")): worker.set_wosalary(Float.parseFloat(JOptionPane.showlnputDialog( "Enter The Worker Salary")): workerlist.add(worker); ch=JOptionPane.showlnputDialog("Would you want to input one more worker?(Y/N)"); //??? } while ((ch=='Y")|(sh=='y')); }
Expert Solution
steps

Step by step

Solved in 5 steps with 2 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY