flexycode / CCPRGG1L_ACTIVITY_COM23P

CCPRGG1L-COMP23P Group Project for 1st semester final exam project, Exercises and Lab Activity for Professor Jay Abaleta
6 stars 4 forks source link

Final revision of the project #9

Open flexycode opened 6 months ago

flexycode commented 6 months ago

We revert the changes to our final commit last time due to some minor bug on the switch statement. Whenever we select the number 4 which is the check balance after successfully creating an account, the output always prompting to be null! in the Account name whenever checking the personal Account balance.

📫 Solution to the error

    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));
    }

🌱 This will be our final solution for now for our major changes