Java Program
Demo this program to the instructor or upload the .java file to Ecampus. Write a program named banketc.java that allows you to set up checking accounts and loan accounts. It should contain 3 classes: Customer, CheckingAccount, LoanAccount. The CheckingAccount and LoanAccount classes inherit from the Customer class. Create an ArrayList of 5 Checking Account customers and an ArrayList of 5 Loan Account customers. Bank of Eastfield The program should be set up in a loop with the following menu options: (1) Bank Information (show BankBalance, Bank Transactions, Number Customers) (2) Print all Checking accounts (3) Deposit Money (ask user for the Record# and Amount) (4) Withdraw Money (ask user for the Record# and Amount) (5) Print Loan accounts (5) Make Loan (ask user for the Record# and Amount of Loan) (6) Make Payment (ask user for the Record# and Payment Amount) Extra Credit: Have options to add and delete customers. Format output for currency. Customer Class Variable Names Variable Description protected String FName, LName Customer's first and last name. protected String Email Customer's e-mail address. protected int CustomerTransactions The total number of transactions (deposits and withdrawals) made by the customer. protected static double BankBalance The bank's total balance (static). You should change this variable when customers make deposits, withdrawals, take loans, and make loan payments. protected static int NumberCustomers The total number of customers at the bank (static). Increment this variable in the CheckAccount and LoanAccount constructors.CheckingAccount Class Variable Names Variable Description private double CheckingBalance The customer's checking account balance. Methods Names Methods Description CheckingAccount (String theLName, The constructor should (1) initialize the name and email variables, (2) set String theFName, String theEmail, CheckingBalance to Opening Deposit, (3) add the OpeningDeposit to the double OpeningDeposit) BankBalance, (5) increment NumberCustomers. getCheckingBalance () The Get method is needed since CheckingBalance is Private. Deposit (Amount) Deposit money into the customer's account (include the amount as a parameter). Remember to increment CustomerTransactions and add Amount to BankBalance. Withdraw (Amount ) Withdraw money from the customer's account (include the amount as a parameter). If the customer overdrafts, charge a $25 fee. Remember to increment CustomerTransactions and subtract Amount from BankBalance.LoanAccount Class Variable Names Variable Description private double LoanBalance The customer's remaining loan principle. Methods Names Methods Description LoanAccount (String theLName, The constructor should: (1) initialize the name and email, (2) set LoanBalance to String theFName, String OpeningLoan * 1.25 for a 25% interest premium, (3) subtract the OpeningLoan from theEmail, double OpeningLoan) BankBalance, (4) increment NumberCustomers. getLoanBalance ( ) Get method since LoanBalance is private MakeLoan (Amount) Add this amount and a 25% interest premium to the LoanBalance. Remember to increment CustomerTransactions and subtract Amount from BankBalance. MakePayment (Amount) Subtract Amount from the LoanBalance. If LoanBalance Check = new ArrayList
( ) ; Check. add (new CheckingAccount ( "Kirk", "David", "dkirk@deced. edu", 10000.0) ) ; Check. add (new CheckingAccount ("Spock", "Mister", "tribbles@starfleet.gov", 500.0) ) ; Check. add (new CheckingAccount ("Scott", "Hulu", "huludaol.com" , 75.0) ) ; ArrayList Loan = new ArrayList() ; Loan . add (new LoanAccount ("Zeus", "Apollo", "apollo@gmail. com", 5000) ) ; Loan . add (new LoanAccount ("Einstein", "Amy", "amy@yahoo.com" , 1000) ) ; Loan . add (new LoanAccount ( "Caesar", "Julie", "julie@hotmail.com", 500) ) ; Printing all Accounts To print all accounts you can use a for loop to step through each ArrayList element. for (int i=0; i