Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Java programming Do the same question with Map Array class Worker private static String woid; private static String woname; private static int wopos; private static

Java programming Do the same question with Map Array

image text in transcribed

class Worker private static String woid; private static String woname; private static int wopos; private static float wosalary public void set wosalary(float salary) { wosalaryssalary; } public static String get woid() { return woid; } public static String get wonamel) { return woname; } public static int get wopos() { return wopos } public static float get wosalary() { return wosalary } public void set woid(String id) { woid=id; } public void set_woname(String name) { woname=name; } public void set wopos(int ipos) { wopos=ipos } w w } 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_woid JOptionPane_showInputDialog("Enter The Worker ld")); worker.set wonamelJOptionPane showInput Dialog("Enter The Worker Name")); worker.set wopos(Integer.parseInt(JOptionPane.showInputDialog "Enter The Worker Position")); worker.set_wosalary(Float.parseFloat(JOptionPane.showInputDialog "Enter The Worker Salary"): workerlist.add(worker); ch-OptionPane.showInputDialog("Would you want to input one more worker?(Y/N)"); //??? } while ((ch==') (sh=='')); }

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

Intranet And Web Databases For Dummies

Authors: Paul Litwin

1st Edition

0764502212, 9780764502217

More Books

Students also viewed these Databases questions