// Practical 8 - Q7 // Marcus Ward // 07/11/2011 /* Program to allow user to enter amount they wish to deposit. Program will continue until user says 'No'. The current bank balance is €500.00 */ import java.util.Scanner; public class BankBalanceLoop { public static void main(String[] args) { Scanner keyboardIn = new Scanner(System.in); double balance = 500.00, newBalance, finalBalance, deposit; // declare variables char response = 'Y'; while (response == 'Y') { System.out.println("Please enter the amount of your deposit: "); // get user input(to be repeated) deposit = keyboardIn.nextDouble(); System.out.println("Your new balance is" + newBalance); newBalance = keyboardIn.nextDouble(); System.out.println("Do you want to make another balance ( Y or N)?"); response = keyboardIn.next().charAt(0); } finalBalance = balance + deposit; System.out.println("Your final balance is" + finalBalance); finalBalance = keyboardIn.nextDouble(); } }
ErrorBankBalanceLoop.java:16: cannot find symbol
symbol : variable Y
location: class BankBalanceLoop
char response = Y;
^
1 error