Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Program wont compile and has errors, need help!! This is the homework, 1-8 must be in the program Account account = new CheckingAccount ( accountNumber,
Program wont compile and has errors, need help!!
This is the homework, 1-8 must be in the program
Account account = new CheckingAccount ( accountNumber, customer, overdraftLimit); accounts. add (account); System.out.println("Thank you, the account number is " + accountNumber); \} public void openSavingAccount(String firstName, String lastName, String ssn) \{ Customer customer = new.Customer(firstName __astName __._Ssnn); customers. add ( customer); int accountNumber = nextAccountNumber++; Account account = new SavingAccount (accountNumber, customer); accounts. add (account); System.out.println("Thank you, the account number is " + accountNumber); 3 public void listAccounts() \{ Scanner scanner = new Scanner(System.in ); System.out. print("Enter account number: "); int accountNumber = scanner.nextInt(); Account account = findAccount (accountNumber); if (account == nul) \{ System.out.println("Account not found"); return; \} System.out.print ln (account); \} public void printAccountStatement() \{ Scanner scanner = new Scanner(System.in); System.out.print("Enter account number:"); int accountNumber = scanner.nextInt(); Account account = findAccount (accountNumber); if (account == nut) \{ System.out.println("Account not found"); return; \} account.printStatement(); \} public void depositFunds () \{ Scanner scanner = new Scanner (System.in); System.out. print("Enter account number:"); int accountNumber = scanner. nextInt ( ); Account account = findAccount (accountNumber); if (account == nul) \{ System.out.println("Account not found"); return; \} System.out.print("Enter the amount to deposit: "); double amount = scanner.nextDouble(); if (account. deposit (amount)) \{ System.out.println("Deposit successful, the new balance is: " + account.getBalance()); \} else \{ System.out.println("Deposit failed, the balance is: " + account.getBalance()); \} \} public void withdrawFunds () \{ Scanner scanner = new Scanner(System.in); System.out. print("Enter account number:"); int accountNumber = scanner. nextInt ( ); Account account = findAccount(accountNumber); if (account == nut) System.out.println("Account not found"); return; \} System.out.print("Enter the withdrawal amount: "); double amount = scanner.nextDouble(); if (account.withdraw (amount)) \{ System.out.println("Withdrawal successful, the new balance is: " + account.getBalance()); \} else \{ System.out.println("Withdrawal failed, the balance is:" + account.getBalance()); \} \} public void closeAccount () \{ Scanner scanner = new Scanner(System.in); System.out. print("Enter account number: "); int accountNumber = scanner.nextInt (); Account account = findAccount (accountNumber); if (account == nut 2 ) } System.out.println("Account not found"); return; \} account. close( ); accounts.remove(account); \} \} When executed, your program should display a menu of options: 1 - Open a Checking account 2 - Open Saving Account 3 - List Accounts 4 - Account Statement 5 - Deposit funds 6 - Withdraw funds 7 - Close an account 8 - Exit The user of the program should be able to enter a choice between 1-6. Any number entered other than 1-6 should be ignored and menu options repeated. 1 - Open Checking Account If option 1 is selected, your program will ask for the following information (the values in black are only for example): Enter first name: Jane (this is an example value) Enter last name: Doe (this is an example value) Enter social security number: 999-999-9999 (this is an example value) Enter overdraft limit: 500 (this is an example value) Once the user has entered information the following confirmation will be displayed, and the main menu will be displayed again: Thank you, the account number is 9999 (this is an example value) 1 - Open a Checking account 2 - Open Saving Account 3 - List Accounts 4 - Account Statement 5 - Deposit funds 6 - Withdraw funds 7 - Close an account 8 - Exit Please enter your choice: 2- Open Saving Account If option 2 is selected, your program will ask for the following information (the values in black are only for example): Enter first name: Jane (this is an example value) Enter last name: Doe(this is an example value) Enter social security number: 999-999-9999 (this is an example value) Once the user has entered information the following confirmation will be displayed, and the main menu will be displayed again: Thank you, the account number is 9999 (this is an example value) 1 - Open a Checking account 2 - Open Saving Account 3 - List Accounts 4 - Account Statement 5 - Deposit funds 6 - Withdraw funds 7 - Close an account 8 - Exit Please enter your choice: 3 - List Accounts If option 3 is selected, your program will list all accounts currently held by the Bank. The output should look like the following: Enter account number: 1001 (this is an example value) Output: Account Number ( ) : First Name >:: 1001 (Checking) : Joe : Blogs : 999-999-9999:17.0: Account Open 1002 (Saving) : Minnie: Mouse : 111-999-9999: 20.0: Account Open 1 - Open a Checking account 2 - Open Saving Account 3 - List Accounts 4 - Account Statement 5 - Deposit funds 6 - Withdraw funds 7 - Close an account 8 - Exit Please enter your choice: 4-Account Statement If option 4 is selected, your program will ask for the account number and then print a statement for the account. If the account number does not exist then an error message will be displayed. Enter account number: 1001 (this is an example value) Output: : : : : Balance: Example: 123 : Credit : 10.00 124 : Credit : 1.00 125 : Debit :5.00 Balance: 6.00 Or Account not found 1 - Open a Checking account 2 - Open Saving Account 3 - List Accounts 4 - Account Statement 5 - Deposit funds 6 - Withdraw funds 7 - Close an account 8 - Exit Please enter your choice: 5-Deposit funds If option 5 is selected, your program will ask for an account number and an amount. The confirmation message will state if the deposit succeeded or failed or if the account could not be found. Enter account number: 1001 (this is an example value) Enter the amount to deposit: 12.0 (this is an example value) The output will be one of the following messages: Deposit successful, the new balance is: Or Deposit failed, the balance is: Account not found 1 - Open a Checking account 2 - Open Saving Account 3 - List Accounts 4 - Account Statement 5 - Deposit funds 6 - Withdraw funds 7 - Close an account 8 - Exit Please enter your choice: 6-Withdrawal If option 6 is selected, your program will ask for an account number and an amount. The confirmation message will state if the deposit succeeded or failed or if the account could not be found Enter account number: 1001 (this is an example value) Enter the withdrawal amount: 5.0 (this is an example value) The output will be one of the following messages: Withdrawal successful, the new balance is: Or Withdrawal failed, the balance is: Or Account not found 1 - Open a Checking account 2 - Open Saving Account 3 - List Accounts 4 - Account Statement 5 - Deposit funds 6 - Withdraw funds 7 - Close an account 8 - Exit Please enter your choice: 7-Close an account If option 7 is selected, your program will ask for an account number and print one of the two output messages. Enter account number to close: 1001 (this is an example value) The output will be one of the following messages: Account closed, current balance is , deposits are no longer possible Or Account not found 1 - Open a Checking account 2 - Open Saving Account 3 - List Accounts 4 - Account Statement 5 - Deposit funds 6 - Withdraw funds 7 - Close an account 8 - Exit Please enter your choice: 8- Exit If option 8 is selected, the program will exitStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started