0% found this document useful (0 votes)
4 views

Banking System in Java

The document outlines the creation of a banking system with two types of accounts: checking and saving. It details the properties and methods for an Account class, which is inherited by Cheque and Saving classes, each with specific rules for withdrawals and fees. Additionally, a Bank class is proposed to manage these accounts, including constructors and functions for account management and balance updates.

Uploaded by

21ucs037
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views

Banking System in Java

The document outlines the creation of a banking system with two types of accounts: checking and saving. It details the properties and methods for an Account class, which is inherited by Cheque and Saving classes, each with specific rules for withdrawals and fees. Additionally, a Bank class is proposed to manage these accounts, including constructors and functions for account management and balance updates.

Uploaded by

21ucs037
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

Assume that a bank maintains two types of accounts for each customer, saving and checking.

The
saving account provides compound interest and withdrawal facility. The checking account provides
cheque book facility but no interest. Checking account holders should also maintain a minimum
balance and if the balance falls below this level, a service charge is imposed. The saving account does
not have to maintain a minimum balance, but a service fee will be charged each time withdrawing
money directly from the saving account. Create a class called Account that stores customer account
number, user name, and balance (suggest to use protected for the variable balance).

Inherit the Account class into classes Cheque and Saving, respectively. In the Cheque class, declare
private static final member variables minimBalance and overLimitCharge (set to 1000 and 5
respectively). In the Saving class, declare a private static final member variable called
eachTimeCharge (set to 3.9) that stores each time withdraw service rate. Also create a bank class to
maintain the accounts, which has members bankName and an ArrayList accounts that store checking
and saving accounts. Include the necessary member functions and constructors to achieve the
following tasks:

For the class Account:

Account(): the default constructor which generates an account number using random integer, and
initialize other member variables.

Account(String user): the overloaded constructor that takes the argument for account name and
initialize other member variables.

void display(): displays (print) the account information including user name, account number and the
balance.

• void deposit(float m): accept deposit from a customer and update the balance.

void withdraw(float m): define an abstract method that can be override by the derived class and
enable late dynamically calling corresponding member functions in the derived classes.

float getBalance(); return the balance

• String getUserName(): return the user name

In the checking Cheque class:

⚫ define two constructors similar to those of the parent class account

define a withdraw function that withdraws money according to the user request • In this function,
check if this withdraw is allowed according to the available balance and withdraw limit for each time.

• Calculate over limit service fee if the balance is lower than a limit when applying a withdraw.

• Update the balance

In the Saving class:

⚫ define two constructors similar to those of the parent class account

define a withdraw function that withdraws money according to the user request

• In this function, check if this withdraw is allowed according to the available balance for each time.

Apply a service fee for each time withdraw.


• Update the balance

You might also like