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

Wk4_300

Need help with a question. Due 3/10/2025 @ 9PM n the Week 4 labs, you performed tasks such as creating a cluster, restoring files, configuring account lockout policies, and verifying RAM usage.  Note: Ensure you have completed all lab exercises from Week 4 before completing this assessment. Assessment Details Write a 350-

Event Khusus dan Promosi di Witching Pot

“Saya sangat puas dengan pengalaman taruhan di situs ini. Setiap elemen, dari navigasi hingga pembayaran, berjalan dengan mulus. Ini menunjukkan profesionalisme dan kualitas layanan mereka. Saya pasti akan kembali lagi!”

Business/computer

Isolation Discussion Thread: Cybersecurity — Layering-Abstraction-Process Isolation The NSA has identified what they call the First Principles of cybersecurity. The following lists three of these: Principle Last Name Starts With Layering A through H Abstraction I through Q Process Isolation R through Z For your discussion, describe the principle assigned

D 3 of 459

 Building Block Technologies    What is an operational technology?  How is it similar or different than Consumer IoT? What emerging risks can you identify for an operational technology in a hypothetical utilities distribution monitoring & control environment (pipelines & transmission grids)?

D 2 of 459

  Follow the attach document to complete this work. Questions: 1. Consumer Internet of Things (IoT) has become ubiquitous and represents a major vector of cyber risk. Provide examples of consumer IoT that may be found in your own home (not sharing exact details is OK) 2. Provide a high

D 1 of 459

Follow the attach document to complete this work. Building Block Technologies   1. Software, Hardware, and Network Communications are considered building block technologies for enterprises. Define what they are, how they are used and give an example. 2. What are the most notable cyber risks for each type of building block?

D 8 0f 360

Follow the attach document to complete this work. International Cooperation for Cybersecurity   Prepare a 5- to 7-paragraph briefing statement that explains why wealthy nations and developing nations should work together to improve cybersecurity for the globally connected networks referred to as “the Internet.” Your statement should address the following.

D 7 of 360

Follow the attach document to complete this work. Policy Soup: Dealing with the Aftermath of a New Cybersecurity Policy   Prepare a 5 to 7 paragraph “Expert Opinion” for local government officials. This document should present a strategy for communicating with residents about a new “cybersecurity” policy that requires a

D 6 of 360

Follow the attach document to complete this work.  Partnerships for Improving State and Local Government Cybersecurity   Before you begin, read this report:  National League of Cities ( ) (Click the Download Report link at the bottom of the page) Prepare a briefing statement (3 to 5 paragraphs) for a group

D 5 of 360

Follow the attach instruction to complete this work. Background Briefing: How will the Governor’s Initiatives Improve Cybersecurity for the State’s Critical Infrastructures?   Discussion we transition from federal to state critical infrastructure. You are working for the Chief of Staff (CoS) for a newly elected Governor. The governor asked the

D 4 of 360

Follow the attach instruction to complete this work. Panel Presentation: Privacy Impact Assessments (PIA)  Coordinators of an upcoming conference, attended by federal government IT managers and staff, invited you to participate in a panel presentation about privacy. For this activity, prepare a 5 to 7 paragraph briefing statement which answers

Proj4-final

Project 4: Postmigration Activities  Step 1: Postmigration Activities Overview  Like any software development project, migration projects require careful planning to ensure success. This planning includes the postmigration testing and maintenance phase. Start this project by researching and planning the  postmigration activities that will be required to get BallotOnline’s migrated workloads in

Discussion-4

Discussion: Postmigration Approaches and Activities Contains unread posts Now that you have completed BallotOnline’s cloud migration, you will discuss the cloud postmigration activities and approaches. You should cover the following areas: · What is the business impact after the migration? · How will you manage service-level agreements in the cloud?

D 3 of 360

Follow the attach instructions to complete this work. How does FedRAMP help agencies ensure that Digital Government services are secure?   Must post first. Subscribe The format for your week 3 discussion is a backgrounder (“briefing paper”). Background papers are summaries of issues provided to help decision-makers/leaders/managers make decisions. Decision-makers

D 2 of 360

Follow the attach document to complete this work.  Briefing Statement: Security Implications of OPEN Data   Representatives from the  Joint Committee on Cybersecurity and Information Technology have asked you to provide a briefing as part of their “Cyber Scholars Day.” The committee is sponsoring this day of briefings and outreach for

D 1 of 360

Follow the attach document to complete this work. Growing Reliance on Digital Government Services   Your 1 discussion short paper assignment is to write a  workplace newsletter article. As you work on this type of discussion item, think about the newsletters you receive in your workplace. Are they engaging? Do they

Week 3 Discussion: PUMP Versus PMBOK® Guide Approach

I put the links to both the text and the PMBOK Guide, it is through my school library so it may not come up without my login at the botton of the instructions also in bold letters is the information to both the course text and the guide please let

wk 9 distance edu

PLEASE SEE IF YOU CAN LOOK UP THE READING IN THE FILE PORTION, I WAS NOT ABLE TO PULL IT UP UNFORTUNATELY!  After reading “Applying “Design Thinking” in the Context of Media Management EducationLinks to an external site.,” think about all aspects of learning online: activities, workload, faculty-to-learner communication, and