0% found this document useful (0 votes)
21 views2 pages

Bank

The document describes several banking interfaces and classes - IBank defines withdrawal and deposit methods, IService defines a balance check method, and IUseIPay extends IService and defines additional payment methods. It also defines an Account class with ID, name, and balance fields that other classes can inherit from, as well as SimpleAccount, MembershipAccount, and VIPAccount classes that implement the interfaces and add additional functionality for different account types.

Uploaded by

namnhse161728
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
21 views2 pages

Bank

The document describes several banking interfaces and classes - IBank defines withdrawal and deposit methods, IService defines a balance check method, and IUseIPay extends IService and defines additional payment methods. It also defines an Account class with ID, name, and balance fields that other classes can inherit from, as well as SimpleAccount, MembershipAccount, and VIPAccount classes that implement the interfaces and add additional functionality for different account types.

Uploaded by

namnhse161728
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

IBank interface has initial fields bankName (string type) which has a value “TP BANK” and methods

withDrawAtDesk and depositAtDesk, boths have only parameter with double type.

IService has initial fields today (date type) set today value and method checkBalance (no parameter) will
return double value.

IUseIPay interface will have two methods iPay and internetBanking, boths have only parameter with
double type. Besides it also extends IService

Account object has id (string type), name (string type) and balance (double type). Student should
implement all constructors, getters, setters. Moreover, default constructor (no parameter) will set id,
name is “Empty”, and balance is zero

SimpleAccount class inherites Account and implement IBank. It also owns type (as string). In default
constructor, it should set type is “1”. You override withDrawAtDesk by checking an input parameter “x”
as following conditions: x >= 0 && x < 1000 then checking balance - x - 5.0 >= 5.0 then balance =
balance-x-5.0. Besides depositAtDesk: input parameter x >= 0 and x < 10000 then balance = balance+x

After that toString method will be format as:

MembershipAccount class will inherite SimpleAccount and implement IService. In default constructor, it
should set type is “2”. You will be charged 5.0 when calling checkBalance service and return balance. The
toString method will be format as:

VIPAccount class will inherite Account and implement IBank, IUseIPay. You should implement some
method as follows

withDrawAtDesk: input parameter x >=0 then if balance - x - 1.0 >= 5.0 then balance = balance-x-1.0

depositAtDesk: input parameter x >=0 then balance = balance+x

checkBalance: you will be charged 1.0 when calling checkBalance service and return balance.

internetBanking: will inform that you use service “Internet banking delegates for desk helper” then
checking input parameter x. If x >= 0 then calling depositAtDesk otherwise calling withDrawAtDesk with
absolute value of x

iPay: will inform that you use service “iPay delegates for internet service helper” then calling
internetBanking service

toString method will be format as:

OUT PROGRAM TEST CASE

You might also like