When I try to run my program, it lets me enter in the beginning balance, interest rate, and number of months. However, when it hits the for loop, it completely skips over everything inside of it and prints out the amount that was entered for the starting balance. Can someone please help?
// Create decimal formatter for dollar amount
DecimalFormat dollar = new DecimalFormat("###,###.00");
// Get beginning balance
input = JOptionPane.showInputDialog("Please enter starting account balance: ");
// Create a BankAccount object
BankAccount account = new BankAccount(input);
// Check to make sure dollar amount account balance is valid amount
// Get interest rate
input = JOptionPane.showInputDialog("Please enter interest rate: ");
// Get number of months
input = JOptionPane.showInputDialog("Please enter number of months: ");
for (int i= 1; i<= numMonths; i++)
{ // Begin for loop
input = JOptionPane.showInputDialog("Please enter deposited amount: " + i);
account.deposit(deposit);
input = JOptionPane.showInputDialog("Please enter withdrawal amount: " + i);
account.withdraw(withdraw);
} // End for loop
// Display new balance
JOptionPane.showMessageDialog(null,
"The current available balance is $ " +
dollar.format(account.getBalance()));