Array help needed
I am having problems with a code that I have to create this is what is being asked of me to do
1. Reads input for each customer object from a file. (each separated by tab char):
firstNamelastNamecitystatezip
2. Create and submit your data file; name it customerData.txt The name of the data file should be a command line argument.3. Create an array of size 20 and store each object created in 1 above in the array. You will need to keep track of the end of the array, so it can hold a variable number of customers.4. Place 10 customer objects in your array.
5. print
I am not sure what I am doing wrong.
Here is my .txt
10
Dillin Jake York PA 17409
Valdir John Chicago IL 98098
Morphy Bob Harrisburg PA 73829
Spears Johnathan Chicago IL 09182
Simpson Bloo Los Angeles CA 94840
Griffin Taylor York IL 49283
Cartmen Eric Philadelphia PA 28192
Connaly Teds Springfield IL 12930
Marsh Stan Miami FL 48392
William Thomas Reno NV 39029
and this is the code:
public class TestCustomer {
publicstaticvoid main (String[] args)throws FileNotFoundException{
Scanner scan =new Scanner (new File ("customerData.txt"));
Customer[] customer;
customer =new Customer [40];
int numLines = scan.nextInt();
for (int i = 0; i < numLines; i++){
String fName = scan.next();
String lName = scan.next();
String city = scan.next();
String state = scan.next();
int zip= scan.nextInt();
System.out.println(fName +", "+ lName+"" + city +""+ state +""+ zip);
Customer newObj = Customer(fName,lName,city,state,zip);
Customer[i]=newObj;
}
}
}

