Question: Using Java, I am trying to read in a file with the format outlined below. AARON, ELVIA J WATER RATE TAKER WATER MGMNT $87,228.00 AARON,
Using Java, I am trying to read in a file with the format outlined below.
"AARON, ELVIA J" WATER RATE TAKER WATER MGMNT "$87,228.00" "AARON, JEFFERY M" POLICE OFFICER POLICE "$75,372.00" "AARON, KARINA" POLICE OFFICER POLICE "$75,372.00" "AARON, KIMBERLEI R" CHIEF CONTRACT EXPEDITER GENERAL SERVICES "$80,916.00" "ABAD JR, VICENTE M" CIVIL ENGINEER IV WATER MGMNT "$99,648.00" "ABARCA, ANABEL" ASST TO THE ALDERMAN CITY COUNCIL "$70,764.00" "ABARCA, EMMANUEL" GENERAL LABORER - DSS STREETS & SAN "$40,560.00" "ABBATACOLA, ROBERT J" ELECTRICAL MECHANIC AVIATION "$89,440.00" "ABBATEMARCO, JAMES J" FIRE ENGINEER FIRE "$84,396.00" "ABBATE, TERRY M" POLICE OFFICER POLICE "$80,724.00" "ABBOTT, BETTY L" FOSTER GRANDPARENT FAMILY & SUPPORT "$2,756.00" "ABBOTT, LYNISE M" CLERK III POLICE "$41,784.00" "ABBRUZZESE, WILLIAM J" INVESTIGATOR - IPRA II IPRA "$65,808.00" "ABDALLAH, ZAID" POLICE OFFICER POLICE "$65,016.00" "ABDELHADI, ABDALMAHD" POLICE OFFICER POLICE "$75,372.00" "ABDELLATIF, AREF R" FIREFIGHTER (PER ARBITRATORS AWARD)-PARAMEDIC FIRE "$90,738.00" "ABDELMAJEID, AZIZ" POLICE OFFICER POLICE "$75,372.00" "ABDOLLAHZADEH, ALI" PARAMEDIC I/C FIRE "$81,672.00" "ABDUL-KARIM, MUHAMMAD A" ENGINEERING TECHNICIAN VI WATER MGMNT "$96,384.00" "ABDULLAH, ASKIA" LEGISLATIVE AIDE CITY COUNCIL "$25,008.00"
The problem I am having is in splitting the file between arrays. The first array has the name example: AARON, ELVIA J ( with or without the comma makes no difference). The second array hold the department and position example: WATER RATE TAKER WATER MGMT. The third array holds the salary as a double example: 87228.00. The code I have so far is below,MY ERROR IS OCCURING AT LINE 33 (String tempName = tokenize[1];) . I need to know how to fix the error and what I am doing wrong. The arrays also need to line up so I can match the index places with the correct records example index 0 in each array contains the information for the same person. If I am going about this all wrong please tell me a better way.
import java.io.*; import java.util.*; public class PA3 { String name; String position; double salary; public PA3(String name, String position, double salary){ this.name = name; this.position = position; this.salary = salary; } // end constructor
public static void main(String[] args) throws Exception { ArrayList
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
