The array is declared with a counter. The counter needs to be used each time an object is added into the array.
// declare Parcel array and parcel count variable
private static Parcel[] parcels = new Parcel[10];
private static int parcelCount = 0;
The information in the scanner needs to create a new Parcel object and store it in the next available (empty) spot in the array parcels.
Heres what Ive got. It doesn't seem to be working. What am I doing wrong?
System.out.print("Enter Parcel Number: ");
String parcelNumber = sc.nextLine();
String [] parcels = new String[0];
parcelCount ++;
System.out.print("Enter Sender Name: ");
String senderName = sc.nextLine();
String [] parcels = new String[1];
parcelCount ++;
System.out.print("Enter Return Address: ");
String returnAddress = sc.nextLine();
String [] parcels = new String[2];
parcelCount ++;
System.out.print("Enter Recipient Name: ");
String recipientName = sc.nextLine();
String [] parcels = new String[3];
parcelCount ++;
System.out.print("Enter Delivery Address: ");
String deliveryAddress = sc.nextLine();
String [] parcels = new String[4];
parcelCount ++;