Question: Java programming A local bank is designing software to manage bank accounts of its customers. The customers have a choice of two types of accounts:

Java programming

A local bank is designing software to manage bank accounts of its customers. The customers have a choice of two types of accounts: free account and overdraft account. A free account is a bank account that does not allow overdrafts: a withdrawal that would make the account's balance negative will not permitted. An overdraft account allows overdrafts, but if the account's balance drops below zero a fixed charge of 10 pounds is imposed for withdrawals from overdrawn accounts.

The planned software package will contain: an interface called Account, abstract class called AbstractAccount and two concrete classes: FreeAccount and OverdraftAccount.

Assuming that Account interface is defined as follows:

public interface Account

{

// Deposits money in the account.

void deposit (int amount);

// Returns the account number.

int getAccountNumber ();

// Returns the account balance;

int getBalance ();

// Withdraws money from the account.

int withdraw (int amount);

}

Design a hierarchy of classes containing, apart from the above interface, the following classes:

a) AbstarctAccount class;

b) FreeAccount class;

c) OverdraftAccount class;

An additional explanation: the withdrawal method in the Account interface will return the amount of money withdrawn, which will be zero if there are insufficient funds in the account for the requested withdrawal ( in the case of a free account).

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!