Assessment 2: A Distributed Banking System

weaverchurchΛογισμικό & κατασκευή λογ/κού

15 Αυγ 2012 (πριν από 5 χρόνια και 2 μήνες)

205 εμφανίσεις

3COM0107 FOOD Online 2005
-
6 Semester B


Assignment 2

1


Ass
ign
ment 2:
The School Cashless Canteen System

Stage 1: A simple distributed system

There is a single
CreditCard
Server

object,
which
maintains account information for the
parents
credit cards

in a collection of
CreditA
ccount

objects which are updated by

remote clients using Java
RMI (Remote Method Invocation). A
CreditA
ccount

has
four

fields
, which will be set to initial
values when an
Account

is created
:


1.

account number (a
String
)

2.

password (a
String
)

3.

balance (a
double
)

4.

creditLimit(a
double
)



The only
remote operation on the
CreditCard
Server

is:



public
Credit
Account getAccount (String
cardNumber
,


String securityNumber)



String expiryDate
)


This returns the appropriate
CreditA
ccount

object to th
e client, although you will need to deal with
the
cases where the account number isn’
t recognized, and where the account number is valid but the
password is wrong.


The operations on

a

CreditA
ccount

object

which the client needs are
:




public void withdra
w (double amount);



public double get
AvailableFunds
();


These h
ave the obvious effects, but not
e th
at if withdraw is called with an
amount

that would
require
more funds than available
, then the call to
withdraw

has no effect on the state of the
CreditA
cco
unt
.


In this initial stage, write the classes and interfaces needed to make
CreditCard
Server

a remote
object, with a
CreditCard
ServerImplementation

class that registers itself with the RMI
registry.
For testing purposes, y
our implementation should
set up

a map in memory with

the following

CreditA
ccount

objects
created from the data
"hard
-
coded" into your server initialization code:

3COM0107 FOOD Online 2005
-
6 Semester B


Assignment 2

2




Card Holder
name

Card
Number

Security
number

Expiry
Date

Balance

CreditLimit

123

3562456

463

10/06

23.98

1000

983

345662
3

362

12/09

576.80

1500

674

6546334

432

01/07

92

500

555

5536633

345

09/06

10.47

9500

532

5267455

664

09/06

-
2314.62

6000



For the client,
just write a test driver that obtains a reference to the
CreditCard
Server

from the
registry, and then contains h
ard
-
coded calls to
getAccount

to retrieve references to
Account
s, and to
the
Account

methods to test that deposit and withdraw work properly.


Zip your
NetBeans project

into

a
single
file called
BA
-
stage1.zip
.


Stage 2: Adding graphical user interface
s

for

the cashing system

Now extend your project from stage 1 to provide graphical user interfaces for the client and server. You
are to decide the 'look
-
and
-
feel' for these GUIs. Do not spend lots of time getting your GUIs to look
attractive
-

you will get m
ost of the marks if you are able to access the functionality that you implemented
in stage 1 from
these
graphical user interfaces.


The client GUI should display a form with text fields for entry of the user's
card

numbe
r, expiry date and
card holder name

and a button enabling the user to "log in" to the system. If the login is successful, the
user is provided with a form showing their current
available funds
, and enabling them to enter an amount
to be withdrawn. You should provide informative and diagnos
tic
appropriate

messages.


The server GUI should allow an administrator to
:



view a list of all accounts



change the
credit

limit for an existing account



add a new account



d
elete an existing account.



view a list of all accounts with balance above or below a
given value


Use the same initial test data as in Stage 1.


Zip your NetBeans project into a single file called
BA
-
stage2
.zip
.

Stage 3: Adding a database

Now extend your project from stage 2 to use a database to store the account details. We will provide
an
MSAccess database containing a table of account details. You should modify your server code so that all
of the functionality from stage 2 is available using the database for account storage.


Zip your NetBeans project into a single file called
BA
-
stage
3
.zip
.