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

Computer Science Wk 2 assignment

Please see attachment for instructions provide a one-page response to the following topic below utilizing supporting documentation obtained from your textbooks and the Internet.  Be sure to include an APA Reference Page Topic: Assess the various Access Control methods.

Discussion and Replies

Please see attachment for instructions.       In 250 words total, answer the questions below with 4 evidence base scholarly articles. APA format. Based on the readings for chapter 3 Information Security Fundamentals and chapter 3&4 Information Security: Design, Implementation, Measurement, and Compliance, Discuss the following. 1. What are

How can businesses benefit from incorporating AI Integration Services into their digital transformation strategies?

[url= Integration Services[/url] are transforming businesses by streamlining operations, enhancing customer experiences, and enabling data-driven decisions. By automating repetitive tasks, AI frees up resources for more strategic activities, improving productivity. AI tools like chatbots and recommendation engines offer personalized solutions, fostering customer loyalty. AI also helps businesses analyze large datasets

OSINT Project 2

 Download the attached detailed assignment description for this project. You should also review the rubric shown below for additional information about the requirements for the project and how your work will be graded. Please make sure that you use both the assignment description file AND the rubric when completing your work. 

OSINT Project

Instructions Download the attached detailed assignment description for this project. You should also review the rubric shown below for additional information about the requirements for the project and how your work will be graded. Please make sure that you use both the assignment description file AND the rubric when completing your

D 6 of 459

Follow the attach instructions to complete this work Questions: 1. How is technology increasingly used in healthcare beyond electronic health records (HER)?  Give some examples. 2. Would you personally participate in robot assisted/telesurgery as a patient or a medical professional?  Why or why not? Resources 20 Examples Of IoT Wearables

D 5 of 459

Follow the attach instructions to complete the work. Questions: 1. What are service robots and how are they used and categorized?  Give examples of each. 2. How would you leverage service robots to improve the availability, confidentiality, and integrity of a large (20MW+) data center? Resources Robots as a Platform

ITS 10 Help

Ethical Hacking help Login to your NDG Online account. Complete the following labs. Each lab is worth 40 points. NDG Online account Link- Log In | NDG Online Portal ([email protected] Password: Starballplayer23$ 1. NDG Ethical Hacking Lab 10: Web Pentesting 2. NDG Ethical Hacking Lab 11: Client Side Exploitations After

InfSec

 Blockchain technology will revolutionize cybersecurity

ITS 12 Help

Ethical HAcking Login to your NDG Online account. Complete the following labs. Each lab is worth 40 points. NDG Online account Link- Log In | NDG Online Portal ([email protected] Password: Starballplayer23$ 1. NDG Ethical Hacking Lab 08: Password Cracking with JTR and Hashcat 2. NDG Ethical Hacking Lab 17: Creating

ITS 13 Help

Ethical Hacking  Login to your NDG Online account. Complete the following labs. Each lab is worth 40 points. NDG Online account Link- Log In | NDG Online Portal ([email protected] Password: Starballplayer23$ 1. NDG Ethical Hacking Lab 06: Network Analysis 2. NDG Ethical Hacking Lab 07: Evading IDS Submit Your Lab

Replies

please see attachment for instructions   In 400 word total, replying to the 2 post below. Each reply must be 200 word.      N.B Post #1 Hello classmates,   I am active duty in the military and currently on Eastern Standard Time. I have 4 kids, I’ve been in

channing 4.25 r studio work

follow the insrtuction Group Project Mostafa Rezaei Big Data (Introduction to Data Science) General information The group project gives you the opportunity to practice many of the skills we learned in the class. It includes 5 steps: Step 1: Find and describe a data set Find a publicly available data

Computer Science English Homework

● Assignment to do For this assignment, research different tools that cloud storage service providers use to manage the vast arrays of drives in their environments. Also, research the current performance and trends of the types of hard drives in use: magnetic vs. SSD. Summarize your research in a 2-3

SQL Help13

Statements and query For the final project, you will be working with a Guitar Shop.  You will need the MySQL server and MySQL workbench installed, just as it has been throughout the class. You will also need the following file: Project Requirements: 1. Execute the attached create_my_guitar_shop.sql to create the

Computer Science WK1 Assignment

Please see attachment for instructions and PDF book     W1 Assignment Instructions:   In 2 pages, answer the questions below with 5 evidence base scholarly articles in APA format.  Recommend and expand upon Information Security & Risk Management. 1. What are some internal and external security threats when dealing