Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

When did Ritas eating behaviors begin to become pathological?

Answered: 1 week ago