Open flexycode opened 7 months ago
// CASE 1: Creating new account private static void createNewAccount(Scanner scanner) { if (accountCount >= MAX_ACCOUNTS) { System.out.println("Maximum account limit reached."); return; }
System.out.print("Enter Account Name: ");
String accountName = scanner.next();
accountNames[accountCount] = accountName;
accountNumbers[accountCount] = accountCount;
balances[accountCount] = 0.0;
System.out.println("Account created successfully. Your account number is: " + accountCount);
accountCount++; // By moving the incrementation syntax after the display will now align with array indices, starting from 0.
}
Sorry nakalimutan ko yung tinuro mo sakin mag pull req pag sa web lang.
My final rendition regarding on this issue. Previously, before I post this issue. I also come up with my own solution without using incrementation syntax, but I am not satisfied with my input. So I decide to seek some help with you guys. So here's the solution for this project.
private static void createNewAccount(Scanner scanner) {
if (accountCount >= MAX_ACCOUNTS) {
System.out.println("Maximum account limit reached.");
return;
}
System.out.print("Enter Account Name: ");
String accountName = scanner.next();
accountNames[accountCount] = accountName;
accountNumbers[accountCount] = accountCount;
balances[accountCount] = 0.0;
accountCount++;
System.out.println("Account created successfully. Your account number is: " + accountCount);
accountCount++;
}
private static void createNewAccount(Scanner scanner) {
if (accountCount >= MAX_ACCOUNTS) {
System.out.println("Maximum account limit reached.");
return;
}
System.out.print("Enter Account Name: ");
String accountName = scanner.next();
accountNames[accountCount] = accountName;
accountNumbers[accountCount] = accountCount - 1; // Assign the current accountCount - 1 as the account number
balances[accountCount] = 0.0;
accountCount++;
System.out.println("Account created successfully. Your account number is: " + (accountCount - 1));
}
We will push Gab's solution to the main repository, so we can move forward to our project and submit it this week. 🌱
Kindly fix some slight bug / error of the function. Particularly in lines of code in 60-66, and 10
Everytme I select 1 and successfully create the account.
It always prompting that the "Account created successfully. Your account number is 1"
But the counting is always starting in 0 whenever I select the windraw, deposit and display account.