Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In java, i have a text file , I read the information from the text file and set them to variables, my program has a

In java, i have a text file , I read the information from the text file and set them to variables, my program has a bunch of classes with getters and setters but i want to create an array for 3 different types of the classes and use the setters from those three classes and have different objects because the text files have different lines of information that each line needs to be stored in a different part of the array, im not sure if im saying this properly but please help with some code

String theLine =input.nextLine();

String[] fields = theLine.split(",");

String staffType = fields[0];

String firstName = fields[1];

String lastName = fields[2];

int staffId = Integer.parseInt(fields[3]);

int department = Integer.parseInt(fields[4]);

int month = Integer.parseInt(fields[5]);

int day = Integer.parseInt(fields[6]);

int year = Integer.parseInt(fields[7]);

String gender = fields[8];

String phoneNum = fields[9];

String email = fields[10];

this is how i stored them but now i want to set them using setters from another class

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

Secrets Of Analytical Leaders Insights From Information Insiders

Authors: Wayne Eckerson

1st Edition

1935504347, 9781935504344

Students also viewed these Databases questions