My code is 99%, 1 error I can't fix, can you?
public class BankAccount
public static void main(String args)
Scanner keyboard = new Scanner(System.in);
System.out.println("Enter your bank account dollars in whole dollars and cents.");
double initialBalance = keyboard.nextDouble();
System.out.println("Enter interest on your bank account as a whole number.");
System.out.println("For example, a 4.5% interest rate would be entered as \"4.5\":");
double interestRate = keyboard.nextDouble();
double yearBalance = initialBalance;
double monthBalance = initialBalance;
double dayBalance = initialBalance;
for (year = 1; year <= 10; year++)
yearBalance = (yearBalance * (interestRate / 100.0));
for (month = 1; month <= 120; month++)
monthBalance = (monthBalance * (interestRate / 1200.0));
for (day = 1; day <= 3650; day++)
dayBalance = (dayBalance * (interestRate / 36500.0));
System.out.println("An initial investment of " + initialBalance + " will become one of the following over ten years.");
System.out.println("If interest is accrued yearly at " + interestRate + "%, you will have a total of " + yearBalance + ".");
System.out.println("If interest is accrued monthly at " + interestRate + "%, you will have a total of " + monthBalance + ".");
System.out.println("If interest is accrued daily at " + interestRate + "%, you will have a total of " + dayBalance + ".");
System.out.println("Would you like to calculate again using a different balance and/or interest rate? Answer \"Y\" or \"N\":");
answer = keyboard.nextLine().toUpperCase().charAt(0);
} while (answer == 'Y');
--- Update ---
the error shows the carrot under the word answer, on the last "while" line
Re: My code is 99%, 1 error I can't fix, can you?
Please copy and paste here the full text of the error messages.
Please edit your post and wrap your code with
<YOUR CODE HERE>
to get highlighting and preserve formatting.