Here's the code:
while (keepGoingDay.equals("y") || keepGoingDay.equals("y")){
System.out.println(acct1);
System.out.println(acct2);
Account.reset();
while (keepGoing.equals("y") || keepGoing.equals("y"))
{
//get account number, what to do, and amount
System.out.print("\nEnter the number of the account you would like to access: ");
acctNumber = scan.nextLong();
System.out.print("Would you like to make a deposit (D) or withdrawal (W)? ");
action = scan.next();
System.out.print("Enter the amount: ");
amount = scan.nextDouble();
if (amount > 0)
if (acctNumber == acct1.getAcctNumber())
if (action.equals("w") || action.equals("W"))
acct1.withdraw(amount);
else if (action.equals("d") || action.equals("D"))
acct1.deposit(amount);
else
System.out.println("Sorry, invalid action.");
else if (acctNumber == acct2.getAcctNumber())
if (action.equals("w") || action.equals("W"))
acct1.withdraw(amount);
else if (action.equals("d") || action.equals("D"))
acct1.deposit(amount);
else
System.out.println("Sorry, invalid action.");
else
System.out.println("Sorry, invalid account number.");
else
System.out.println("Sorry, amount must be > 0.");
System.out.print("\nMore transactions? (y/n)");
keepGoing = scan.next();
}
System.out.println("End of day stats: ");
System.out.println("Number of deposits: " + Account.getNumDeposits());
System.out.println("Number of withdrawals: " + Account.getNumWithdrawals());
System.out.println("Total value of deposits: " + Account.getTotalDeposits());
System.out.println("Total value of withdrawals: " + Account.getTotalWithdrawals());
System.out.print("More days?");
keepGoingDay = scan.next();
}
}
I don't think the methods are too essential to this so I'll leave them out to save space.
The goal of this program is to have transactions be recorded and counted for multiple days (unknown amount so I couldn't use a for loop).
It goes through the first run fine and after that, it skips over the inner while loop.
I've looked at the braces and don't think that's the issue.