this is my array of objects, because its not allowed to use arraylist and this is is the one i know. I just used 3 for me to be able to practice before making it bigger
veco[] accountList = new veco[3];
accountList[0] = new veco(accountNumber,billCode,billDate,accountName,accountAddress,customerNumber, periodTo,periodFrom,presentReading,previousReading,previousBalance,dueTotal);
accountList[1] = new veco(accountNumber,billCode,billDate,accountName,accountAddress,customerNumber, periodTo,periodFrom,presentReading,previousReading,previousBalance,dueTotal);
accountList[2] = new veco(accountNumber,billCode,billDate,accountName,accountAddress,customerNumber, periodTo,periodFrom,presentReading,previousReading,previousBalance,dueTotal);
this is the case where I look for the same account number. when i use the accountNumber that is stored in accountList[0], it will check the accountNumber. But when I use the accountNumber except the accountList[0] it will go directly towards the else which says Account ID doesn't exist in the database
System.out.print("\nEnter Account Number: ");
int b = scanner.nextInt();
for (int j = 0; j < accountList.length; j++) {
if (b == accountList[j].getAccountNumber()) {
System.out.println("Customer Account Number: " + accountList[j].getAccountNumber());
System.out.println("Customer Account Name: " + accountList[j].getAccountName());
System.out.println("Customer Account Address: " + accountList[j].getAccountAddress());
System.out.print("Customer Number: " + accountList[j].getCustomerNumber());
System.out.println("\nBilling Code\t\tBilling Date\t\tAmount Due");
for (j = 0; j < accountList.length; j++) {
if (b == accountList[j].getAccountNumber()) {
System.out.println(accountList[j].getBillCode() + "\t\t\t" + accountList[j].getBillDate() + "\t\t\t" + (df.format(accountList[j].getDueTotal())))
}
}
} else {
System.out.print("Account ID doesn't exist in the database.\n");
break;
}
}