Our Services

Get 15% Discount on your First Order

[rank_math_breadcrumb]

hw 5

please review the info below 

Write a program named bank.java that allows you to set up checking accounts and loan accounts.  This file should include 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.

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 all Loan accounts 
(6)  Make Loan (ask user for the Record# and Amount of Loan)
(7)  Make Payment (ask user for the Record# and Payment Amount)
(8)  Exit

Extra Credit: Have options to add and delete customers.

Customer Class

Variable Names

Variable Description

String FName, LName

Customer’s first and last name.

String Email

Customer’s e-mail address.

int CustomerTransactions

The total number of transactions (deposits and withdrawals) made by the customer.

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.

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, String theFName, String theEmail, double OpeningDeposit)

The constructor should (1) initialize the name and email variables,  (2) set CheckingBalance to OpeningDeposit,  (3)  add the OpeningDeposit to the 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, String theFName, String theEmail, double OpeningLoan)

The constructor should: (1) initialize the name and email,  (2) set LoanBalance to OpeningLoan * 1.25 for a 25% interest premium,  (3) subtract the OpeningLoan from 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 <= 0, output a message (e.g. “Customer X just payed off his/her loan!”).  Remember to increment CustomerTransactions and add Amount to BankBalance.


How to Declare an ArrayList of Objects

In your main program, declare two ArrayLists – one for CheckingAccount and one for LoanAccount.   You can use the data below to get started.

ArrayList<CheckingAccount> Check = new ArrayList<CheckingAccount>();
Check.add(new CheckingAccount(“Kirk”,”David”,”[email protected]”,10000.0));
Check.add(new CheckingAccount(“Spock”,”Mister”,”[email protected]”,500.0));
Check.add(new CheckingAccount(“Scott”,”Hulu”,”[email protected]”,75.0));

ArrayList<LoanAccount> Loan = new ArrayList<LoanAccount>();
Loan.add(new LoanAccount(“Zeus”,”Apollo”,”[email protected]”,5000));
Loan.add(new LoanAccount(“Einstein”,”Amy”,”[email protected]”,1000));
Loan.add(new LoanAccount(“Caesar”,”Julie”,”[email protected]”,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<Check.size(); i++)
{
   System.out.println (i + “\t” + Check.get(i).GetLName() + “, ” + Check.get(i).GetFName() + “\t” + Check.get(i).getCheckingBalance() + “\t” + Check.get(i).CustomerTransactions);
}

Retrieving (static) Bank Information

For the static variables, remember that you can use any of the array elements and either the Check class or Loan class – they all point to the same variable.  The following two lines give you the same answer:

System.out.println( Check.get(0).BankBalance );
System.out.println( Loan.get(0).BankBalance );

Example Output

//Option 1 to print bank information
====================================================
| Bank of Eastfield Information
|
| Total Bank Balance: 4075.0
| Total Bank Customers: 6
====================================================

//Option 2 to print checking accounts
====================================================
| Checking Accounts
| Rec Name           Balance   Transactions
| —————————————–
| 0   Kirk, David    10000.0   3
| 1   Spock, Mister  500.0     0
| 2   Scott, Hulu    75.0      2

//Option 3 to deposit money
====================================================
Enter checking record number:
2
Amount to deposit:
100
Scott Hulu now has $175.0
 

If not clear the screen shot is below

image1.jpeg

image2.png

image3.png

image4.png

image5.png

image6.png

Share This Post

Email
WhatsApp
Facebook
Twitter
LinkedIn
Pinterest
Reddit

Order a Similar Paper and get 15% Discount on your First Order

Related Questions

computering part 7

The goal of this project is to integrate your various components into polished, professional products. Follow the instructions below to ensure a successful submission: Apply Feedback: Review and incorporate all feedback received from previous submissions (Parts 2-6). Enhance and Improve: Refine any of the three required items (cover letter with

Discussion and Replies

Please see attachment for instructions     Discussion   In 250 words total, answer the questions below with 4 evidence base scholarly articles. APA format. Based on the readings this week, 1. Discuss some common strategies and pitfalls you have seen with business continuity. 2. Discuss some common strategies and

sociology

The goal of this project is to integrate your various components into polished, professional products. Follow the instructions below to ensure a successful submission: Apply Feedback: Review and incorporate all feedback received from previous submissions (Parts 2-6). Enhance and Improve: Refine any of the three required items (cover letter with

Python

  Instructions Create a simple Python application (Save as w5_firstname_lastname.py) . Create a Python script that takes two parameters to do the following:- 1) List all files names, size, date created in the given folder 2) Parameter1 = Root Folder name Parameter2= File size >>> to filter file size (

Python

  Instructions:  Describe methods for securing Python code. Pick at least ONE of the methods for securing node and deep dive into what it means and how it is used to secure code.   

Discussion 8 of 459

Follow the attach instruction to complete the work. 1. What is one specific technology you found the most intriguing throughout the course? 2. If you were to be a hacker, which building block vector would you choose to attack your selected technology and why?

WK 4 Discussion and Replies

Please see attachment for instructions     Discussion   In 250 words total, answer the questions below with 4 evidence base scholarly articles. APA format. Discussion on access control and physical security. These areas found to be one or more points of weakness in audit 1. Discuss some common points of

Node.js

  Instructions Create a simple Node.js server (Save as w4_firstname_lastname.js) . Create a restful application similar to the one in lesson 4 (ReSTFul Web Services). Document the routing table, and the application you created. Submit your week 4 work in w4_firstname_lastname.txt (Please save the file as a text file and

Computer Science- Python Gurobi assignment

I need the output following these steps: Put all of these files into the same folder, Open the python file, If there is any error, check if any file is missing, It has 105 counties and 4 districts, so it will take a while to finish running. I need it

Research Project

Please follow the instructions attached below:  I have choose the topic from the list is:   PROJECT TITLE Firm RTOS – Balancing Real-Time Performance and Flexibility Please check the abstract from my file and write the research project. 

provide me java based interview question.

Core Java Interview Questions (Basic Level) 1. What is Java? Java is a high-level, object-oriented, platform-independent programming language developed by Sun Microsystems. 2. What are the features of Java?  Object-Oriented  Platform Independent (via JVM)  Secure and Robust  Multithreaded  Architecture Neutral  High Performance (via JIT

Dynamons world Mod APK

 What are the best tips for playing RPG games like Dynamons World? I recently found a great resource at that offers a lot of insights and even MOD APKs for Dynamons World, but I’d love to hear personal strategies and gameplay advice from the community too! ???????? 

459 w7

Follow the attach instructions to complete this work. Questions: 1. What is Generative AI and how is it similar/different to Traditional AI? 2. Do you believe that work created by Generative AI (e.g. ChatGPT) is comparable in quality to human created content?  What challenges and opportunities  does Generative AI pose

Computer Science WK3 Assignment

Please see attachment for instructions ISSC680 Week 3 Homework Assignment Instructions: Please provide a one-page response to the following topic utilizing supporting documentation obtained from the attach books and the Internet. APA format and reference. Topic: Differentiate between the different types of cryptographic algorithms.

Discussion and Replies

Please see attachment for instructions     Discussion   In 250 words total, answer the questions below with 4 evidence base scholarly articles. APA format. Based on this weeks readings, 1. Discuss some effective strategies for Security Awareness in your organization or 2. What you would like to see implemented