Você está na página 1de 4

Threaded Case Study

A Banking Application: The JBANK

Objectives
The JBANK is an electronic banking service using the popular programming and development language
Java. As the Java programmer, the student will design Java classes and objects that will allow the
JBANK to conduct the bank’s business electronically. In some labs, the student will create slightly
modified versions of the final program in order to demonstrate the variations in Java code.
Students will implement the following when completing the classes for the banking application:
1. Describe the classes needed to implement the business application using simple UML
diagrams.
2. Apply appropriate design patterns to design classes needed to implement the business rules for
the JBANK.
• Design model classes to model business objects and business rules.
• Design controller classes to connect the activity of presentation classes to the model
classes.
• Design presentation classes to display business data and enable business transaction by
using graphical user interfaces (GUIs).
3. Include documentation for all classes, thus generating Java standard documents.
4. Create and test classes that implement the business rules described throughout the project.
5. Create classes that use Java language elements such as modifiers, control structures, data
types, and operators.
6. Create and use classes that demonstrate encapsulation, inheritance, and polymorphism.
7. Create classes that use the Java foundation classes.
8. Create classes that use multithreading, read and write to files, and network between computers.
9. Package the classes in Java archive files.

Rules
These are the business rules that the JBANK manager would like the programmer to follow:
1. The bank plans on serving many customers, but would like to limit this solution to 20 customers.
Any attempt by tellers to create more than 20 customers should be prohibited.
2. Each customer will be provided a basic savings account.
3. A customer may have three supporting accounts: an investment savings account; a checking
account with overdraft protection that uses the savings account to make up the difference; and
a checking account with a line of credit that is linked to a credit card.
4. Customer IDs will start with the number 1000 and use the letters “S” (for savings), “O” (for
overdraft checking), “L” (for line of credit checking), and “I” (for investment savings) to indicate
the type of account.
The format of the account identification should be as follows: CustomerID account type. So the
first customer would have a savings account 1000S and up to three other accounts identified as
1000O, 1000L, and 1000I.
5. A customer cannot have more than four accounts, and a customer can only have one of each
type of account.
6. Only the bank manager or the teller can create customers, and accounts can only be created
after all the necessary information for a customer has been obtained.
7. Accounts cannot exist without customers, and customers cannot exist without at least one type
of account.
8. A customer account can only be created during normal hours of operation (Monday through
Friday from 9 am to 5 pm).
9. Certain information must be saved such as the hours of operation, interest rates, the number of
customers created, and customer ID assignments. The teller usually initiates the process of
saving information. The bank manager should be able to modify this information.
These are the rules for each type of bank account:
• Savings accounts require a minimum balance of 10 US dollars. When new customers join
the bank, they are assigned a savings account and must deposit at least 10 US dollars in it.
Customers will be allowed to withdraw money from the savings account at any time.
Customers cannot withdraw amounts exceeding that in the account. The savings interest
rate is 3% per year and it is calculated daily.
• Investment accounts are savings accounts used to save money for an extended period of
time. This account provides customers with a higher interest rate based on how long they
invest money in the account. The longer they keep the money in the account, the higher the
interest rate earned. Investment accounts require a minimum of 100 US dollars to open. An
investment term is how long the money has to remain in the account without any
withdrawals from the account. The minimum investment term is six months. Interest rates
for this account are 6 months at 5% and 12 months at 7%, both compounded monthly. The
penalty for early withdraw is 20% of the balance.
• Checking accounts with overdraft protection are linked to the savings account. Overdraft
protection allows customers to write checks for amounts that exceed the balance in the
checking account. The JBANK provides overdraft protection by linking the customers’
checking account balance to the savings account balance. Customers can withdraw any
amount of money as long as there is adequate money in the checking account, savings
account, or a combination of both. For example, if a customer has 40 US dollars in the
checking account and 100 US dollars in the savings account, then the customer can
withdraw a maximum of 140 US dollars from either account. If the customer withdraws 140
US dollars, the balance of both the savings accounts and the checking accounts is 0.
• Line of credit (LOC) checking accounts are tied to credit cards and have a fixed maximum
credit limit of 500 US dollars. This is a type of checking account where overdraft protection
is provided by allowing a negative balance up to a maximum of 500 US dollars. This type of
account charges the customer a finance charge when the balance in the account is
negative. The customer can only withdraw amounts equal to the balance in the account
plus the credit limit. The amount withdrawn from the credit limit will be the first paid back by
any customer deposit. The interest rate is 18% which is calculated daily.

Phases
The JBANK program will be completed in phases. For the first three phases, the JBANK focuses on
writing code for the bank tellers who will open new accounts for customers and manage existing
customer account information. The Java programmer will then proceed to the fourth phase when GUIs
are created and solutions are found so that the customer account information can be saved in files.
• Phase I: Create Bank, Teller, Customer, and Account classes.
• Phase II: Modify Bank, Teller, and Customer classes.
• Phase III: Create Savings and Accounting classes and subclasses based on the principles
of inheritance, encapsulation, and polymorphism.
• Phase IV: Create the GUIs for tellers, the bank manager, and customers and use utility
classes so that data can be read from files and written to files.
Throughout the course, the student will be presented with a view of the application in its current phase
and a view of the application in its final phase. These views represent the description of the Java
classes using simple diagrams from UML. These diagrams can be viewed at any time.
Classes
This case study uses a simple set of classes to represent the business model:
1. The Bank class maintains information on a specific bank.
2. The Customer class maintains information on a specific customer.
3. The Account class is an abstract class from which subclasses will be extended. Its methods are
all inherited: withdraw, deposit, getbalance, transferFromSavings, setInterestEarned, getDiff,
setBalance, getInterestEarned, and getAcctId.
• Checking is a class used as a basis for the two subclasses:
setfeeAssement, getfeeAssement
• LineOfCredit is an abstraction from the Checking class with line of credit to a credit card.
Methods include:
getCreditBalance, getbalance, getFinanceCharge, getCreditLimit, setCreditBlance,
setFinanceCharge, setCreditLimit, and calcFinanceCharge.
• OverDraftProtect is an abstraction from the Checking class with overdraft protection linked
to the savings account:
transferFromSavings
• Savings class has the following methods:
getbalance, getInterestEarned, setInterestEarned
• Investment is an abstraction of the Savings class:
getbalance, setInterestEarned, setTerm,
4. BankManager class will serve as a client class for the banking classes
5. TellerWindow class
6. ATM class
7. GUI controller classes
• StoreobjectData classes
• RetrieveobjectData classes
8. File I/O classes
• ReadObject read object from file
• WriteObject write object to file
Design patterns
As object-oriented programming has gained the acceptance of programmers and developers, the
development community has identified several patterns for designing classes and groups of classes.
These patterns are referred to as design patterns. One of the most common design pattern is the Model
View Controller pattern. The primary emphasis of this pattern is the creation of three groups of classes.
These are model, view, and controller classes. A simplistic adaptation of this pattern to the JBANK
banking application would result in these groups of classes being designed and created.
• Model classes describe the business data and the business activities in the application. For
example, a model class would hold customer, bank, teller, and account (all types)
information. This class can be used to create objects that hold data and do banking
transactions. Included in this class might be utility classes that read and write to files.
• View classes present business data to the user and allow the user to perform business
tasks. Such classes could be the Teller Window and ATM classes
• Controller classes control the interaction between model classes and view classes. When a
Teller Window object is activated, these classes translate actions performed on the GUI to
appropriate actions on a business object.
In order to launch the application, one or more classes must be capable of serving as an entry point
from which all activity occurs. Such a class is also known as a program. In this application, several
classes serve this purpose. The JBANK banking application has three entry points (or programs): the
Bank Manager program, the Teller program, and the Bank Customer program. A Teller program, for
example, can begin the activities by creating a new customer or depositing and withdrawing amounts for
the customer. The Bank Manager program can begin the activities by the bank manager opening the
bank, setting the operating parameters, or launching a GUI that will interact with a teller. Or a Bank
Customer program can begin transactions by a customer activating an ATM machine.
The first three phases of this application will use the Teller program, that is, the Teller class, as the entry
point of the application. The Teller class will call other classes as needed.
In the JBANK program, model, view, and controller classes are represented by the following:
Model classes (business domain)
Business objects
Bank
Account
Checking
OverdraftProtect
LineOfCredit
Saving
Investment
Customer
Utility classes
ReadCustomerFile
WriteCustomerFile

View classes (Presentation of business data)


Teller GUI class
ATM class

Controller classes
StoreobjectData (from GUI to business object)
RetrieveobjectData (from business object to GUI)
Teller
BankManager
BankClient

Você também pode gostar