You are on page 1of 76

Synopsis

1
Title of the Project: Mobile Banking.

Problem Definition:
Mobile Banking refers to provision of banking- and
financial services with the help of mobile telecommunication devices. The scope of
offered services may include facilities to conduct bank transactions, to administer
accounts and to access customized information.

Why this Topic is chosen:


Mobile devices, especially smart phones, are the most
promising way to reach the masses and to create “stickiness” among current customers,
due to their ability to provide services anytime, anywhere, high rate of penetration and
potential to grow. Mobile users have just started to fully utilize the data capabilities in
their mobile phones. In Asian countries like India, China, Indonesia and Philippines,
where mobile infrastructure is comparatively better than the fixed-line infrastructure, and
in European countries, where mobile phone penetration is very high (at least 80% of
consumers use a mobile phone), mobile banking is likely to appeal even more.

Concepts: Java Technology (J2ME and J2EE)

Objective:
• Customer Service provision so as to make it easier for him to check his
basic account information.
• Anytime, anywhere facility to access his bank account information.
Scope:

Mobile Web applications enable users on the move to access date on their hand
held devices. The various applications built in the project are as follows: Check Balance,
Check status, Fund transfer, Loan status, Locker status and Deposit Details.

Due to it’s Anytime, Anywhere, And Anyplace offerings customers will be able
to access their bank accounts when and wherever they want thus saving their time and
money. They would not be required to travel to the location of their account and carry out
transaction there instead all the banking transactions will be carried out on the mobile
handset itself. This facility is now limited to a particular branch or a particular bank but
in future it can be used to implement banking transactions over accounts belonging to
different banks. The project will be a global success if all the security issues are properly
taken care of and tested for its wide range functionality and implemented accordingly.

Functions:
• Take user information through a jar file loaded on his cell phone.
• Activated General Packet Radio Service (GPRS) connection will allow the
user to send request to the Web server.

2
• Web Server responses by processing the servlet which retrieves
information from the database for the user.

Constraints:
• The user should have a cellphone which connects to the internet.
• The user should have java enabled cellphone.

Methodology:

From the User End:


• The user is provided with a jar file. On opening the jar file, he has to login
to his account with his corresponding password.
• The GPRS being activated will allow the user verification.
• The user queries for various bank details through this jar file.
• He is responded with corresponding replies.

From the Service Providers End:


• The user requests for logging in. After verification he is allowed, else not
allowed to access.
• The user requests for other data. Server process the request by processing
the servlet which gets the corresponding information.
• This response is then sent to the user.

Hardware Requirements:
• Pentium 3- 800 MHZ
• 256 MB RAM
• GPRS enabled mobile phones

Software Requirements:
• Tomcat server
• Java Wireless toolkit
• Windows Operating System
• Ms-Access

The contribution of the project:


Can be enhanced more with security features and implemented at real-time for
various Banks and finance services.

3
Literature
Survey

4
Basic concept and its origin:

Banking:

A banker or bank is a financial institution that acts as a payment agent for


customers, and borrows and lends money. Banks act as payment agents by conducting
checking or current accounts for customers, paying Cheque drawn by customers on the
bank, and collecting Cheque deposited to customers' current accounts. Banks also enable
customer payments via other payment methods such as telegraphic transfer and ATM.

Banks borrow money by accepting funds deposited on current account, accepting term
deposits and by issuing debt securities such as banknotes and bonds. Banks lend money
by making advances to customers on current account, by making installment loans, and
by investing in marketable debt securities and other forms of lending.

Banks provide almost all payment services, and a bank account is considered
indispensable by most businesses, individuals and governments.

Banks offer many different channels to access their banking and other services:

• A branch, banking centre or financial centre is a retail location where a bank or


financial institution offers a wide array of face to face service to its customers
• ATM is a computerized telecommunications device that provides a financial
institution's customers a method of financial transactions in a public space without
the need for a human clerk or bank teller. Most banks now have more ATMs than
branches, and ATMs are providing a wider range of services to a wider range of
users. For example in Hong Kong, most ATMs enable anyone to deposit cash to
any customer of the bank's account by feeding in the notes and entering the
account number to be credited. Also, most ATMs enable card holders from other
banks to get their account balance and withdraw cash, even if the card is issued by
a foreign bank.
• Mail is part of the postal system which itself is a system wherein written
documents typically enclosed in envelopes, and also small packages containing
other matter, are delivered to destinations around the world. This can be used to
deposit Cheque and to send orders to the bank to pay money to third parties.
Banks also normally use mail to deliver periodic account statements to customers.

5
• Telephone banking is a service provided by a financial institution which allows its
customers to perform transactions over the telephone. This normally includes bill
payments for bills from major bill payers. (E.g. for electricity).
• Online banking is a term used for performing transactions, payments etc. over the
Internet through a bank, credit union or building society's secure website.

Online Banking:

Online banking (or Internet banking) allows customers to conduct financial


transactions on a secure website operated by their retail or virtual bank, credit union or
building society. Online banking solutions have many features and capabilities in
common, but traditionally also have some that are application specific.

The common features fall broadly into several categories

• Transactional (e.g., performing a financial transaction such as an account to


account transfer, paying a bill, wire transfer... and applications... apply for a loan,
new account, etc.)
o Electronic bill presentment and payment - EBPP
o Funds transfer between a customer's own checking and savings accounts,
or to another customer's account
o Investment purchase or sale
o Loan applications and transactions, such as repayments

• Non-transactional (e.g., online statements, check links, co browsing, chat)


o Bank statements
• Financial Institution Administration - features allowing the financial institution to
manage the online experience of their end users
• ASP/Hosting Administration - features allowing the hosting company to
administer the solution across financial institutions

Features commonly unique to business banking include

• Support of multiple users having varying levels of authority


• Transaction approval process
• Wire transfer

Features commonly unique to Internet banking include

• Personal financial management support, such as importing data into a personal


finance program such as Quicken, Microsoft Money or TurboTax. Some online
banking platforms support account aggregation to allow the customers to monitor

6
all of their accounts in one place whether they are with their main bank or with
other institutions...

Mobile Web:

The Mobile Web refers to the World Wide Web as accessed from mobile devices
such as cell phones, PDAs, and other portable gadgets connected to a public network.
Access does not require a desktop computer.

However, Mobile Web access today still suffers from interoperability and usability
problems. This is partly due to the small physical size of the screens of mobile devices
and partly due to the incompatibility of many mobile devices with not only computer
operating systems, but also the format of much of the information available on the
Internet.

New tools such as Macromedia's Flash Lite or Sun's J2ME enable the production of
user interfaces customized for mobile devices.

GPRS:

GPRS can be used for services such as Wireless Application Protocol (WAP)
access, Short Message Service (SMS), Multimedia Messaging Service (MMS), and for
Internet communication services such as email and World Wide Web access.
WAP is just a gateway used to access Internet via mobile phone and vice-versa.

Theoretical Analysis:

The advent of the Internet has revolutionized the way the financial
services industry conducts business, empowering organizations with new business
models and new ways to offer 24x7 accessibility to their customers.

The ability to offer financial transactions online has also created new players in the
financial services industry, such as online banks, online brokers and wealth managers
who offer personalized services, although such players still account for a tiny percentage
of the industry.

7
Over the last few years, the mobile and wireless market has been one of the fastest
growing markets in the world and it is still growing at a rapid pace. According to the
GSM Association and Ovum, the number of mobile subscribers exceeded 2 billion in
September 2005, and now exceeds 2.5 billion (of which more than 2 billion are GSM).

According to a study by financial consultancy Celent, 35% of online banking households


will be using mobile banking by 2010, up from less than 1% today. Upwards of 70% of
bank center call volume is projected to come from mobile phones. Mobile banking will
eventually allow users to make payments at the physical point of sale. "Mobile contact
less payments” will make up 10% of the contact less market by 2010.

Many believe that mobile users have just started to fully utilize the data capabilities in
their mobile phones. In Asian countries like India, China, Indonesia and Philippines,
where mobile infrastructure is comparatively better than the fixed-line infrastructure, and
in European countries, where mobile phone penetration is very high (at least 80% of
consumers use a mobile phone), mobile banking is likely to appeal even more.

This opens up huge markets for financial institutions interested in offering value added
services. With mobile technology, banks can offer a wide range of services to their
customers such as doing funds transfer while traveling, receiving online updates of stock
price or even performing stock trading while being stuck in traffic. According to the
German mobile operator Mobilcom, mobile banking will be the "killer application" for
the next generation of mobile technology.

Mobile devices, especially smartphones, are the most promising way to reach the masses
and to create “stickiness” among current customers, due to their ability to provide
services anytime, anywhere, high rate of penetration and potential to grow. According to
Gartner, shipment of smartphones is growing fast, and should top 20 million units (of
over 800 million sold) in 2006 alone.

In the last 4 years, banks across the globe have invested billions of dollars to build
sophisticated internet banking capabilities. As the trend is shifting to mobile banking,
there is a challenge for CIO’s and CTO’s of these banks to decide on how to leverage
their investment in internet banking and offer mobile banking, in the shortest possible
time.

The proliferation of the 3G (third generation of wireless) and widespread implementation


expected for 2003-2007 will generate the development of more sophisticated services
such as multimedia and links to m-commerce services.

Identification of the project from the study:

Mobile Banking is a concept that was developed thinking about the fact that

8
Mobile handsets are a common commodity today and are found to be affordable to the
common man. I realized that how easy it would be to carry out banking transactions if
they were carried out from the mobile handset itself.
I started the research 2 months prior to going along with the project which
involved getting acquainted with the variety of banking operations and also the working
of web and wireless operations.
For my research work, I consulted various banking officials and found out what
are the various banking operations that could be implemented using the mobile handset.
I tried to find out about the practicality of the project by studying the implementations of
the web and wireless applications. I did my research regarding which all sectors of
banking could be implemented using our project. Also the research involved learning
about various software’s available that could be used to implement my project and I
studied the operation of the various mobile emulators for the same.
The idea that mobile phones bring economic benefits is now widely accepted. In
places with bad roads, few trains and parlous land lines, they substitute for travel, allow
price data to be distributed more quickly and easily, enable traders to reach wider markets
and generally ease the business of doing business.
With mobile banking, the customer may be sitting in any part of the world (a true
anytime, anywhere banking) and hence banks need to ensure that the systems are up and
running in a true 24 x 7 fashion.
Mobile banking will be attractive mainly to the younger, more "tech-savvy"
customer segment. A third of mobile phone users say that they may consider performing
some kind of financial transaction through their mobile phone. Most of the users are
interested in performing basic transactions such as querying for account balance and
making bill payment.

9
Design and
Implementa
tion
10
Functional Design:

System Flow Chart Diagram:

Tomcat
User GPRS
Server
(Mobile
device)
Servlet
Servlet
Engine

Service
Bank
Provider
Database
Database

11
Data Flow Diagrams (DFD):

User Request Mobile


User Request Banking
through Mobile &
Phone Billing

Access

User Access through


Fig 01: Level 1.0 DFD Mobile

12
User Request Gets Status

User Request Locker User Access the


through Mobile Status application
Phone through Mobile
Phone
Check Records

Bank DataBase
Fig 02: Level 1.1 DFD

User Request Gets Status

User Request Deposit User Access the


through Mobile Status application
Phone through Mobile
Phone
Check Records

Fig 03: Level 1.2 DFD Bank DataBase

13
User Request Gets Status

User Request Loan User Access the


through Mobile Status application
Phone through Mobile
Phone
Check Records

Fig 04 : Level 1.3 DFD Bank DataBase

User Request Gets Status

User Request Cheque User Access the


through Mobile Status application
Phone through Mobile
Phone
Check Records

Fig 05 : Level 1.4 DFD Bank DataBase

Locker
Login
Status
User Request
Gets Status

User Request User Access the


through Mobile Check Records application
Phone through Mobile
Phone
Bank DataBase
Fig 06 : Level 1.5 DFD

14
Deposit
Login
Status
User Request
Gets Status

User Request User Access the


through Mobile Check Records application
Phone through Mobile
Phone
Bank DataBase
Fig 07 : Level 1.6 DFD

Loan
Login
Status
User Request
Gets Status

User Request User Access the


through Mobile Check Records application
Phone through Mobile
Phone

Fig 08 : Level 1.7 DFD Bank DataBase

15
Bill
Login Payment
User Request Status
Gets Status

User Access the


User Request application
through Mobile Check Records through Mobile
Phone Phone

Bank DataBase

Service ProviderDataBase

Data Dictionary:
Table :01 Customer

Name Data type length constraints

Customer name Text 20 Not null

Phone no Number 10 Not null

Mobile _no Text 10 Not null

Address Text 30 Not null

Gender Text 01 Either ‘m’or ‘f’

Account _type Text 10 Not null

Customer _id Text 10 Not null

16
Account _no Text 05 Not null

Balance Number 10 Min-500

Credit Number 10 Not null

Debit Number 10 Not null

Table: 02 Cheque_status
Account_no text 05 Not null

Cheque_no Number 20 Not null

Amount Number 10 Not null

Deposit_date Date - -

Status text 10 Not null

Table:03 Loan Status


Account_no Text 05 Not null

Loan_id Text 10 Not null

Customer Text 10 Not null

Ramt Number 10 Not null

Iamt Number 10 Not null

Total_amt Number 10 Not null

Due_amt Number 10 Not null

Table:04 Locker_status

17
Account_no Text 05 Not null

Lock_id Text 05 Not null

Ramt Number 05 Not nul

Table :05:DepStat
Account_no Text 05 Not null

Dept_no text 05 Not null

I_date Date - Not null

M_date Date - Not null

Deposit_amt Number 10 Not null

Mat_amt Number 10 Not null

Rate of interest Number 10 Not null

Period Number 2 Not null

Table:06 Login

Login_name Text 10 Not null

Customer_id Text 05 Not null

password Text 10 Not null

Acc_no Text 05 Not null

18
ER DIAGRAM:

19
Name Addr Phno Do
Balanc e
Gender Mobile s
e
Acc_typ
CUSTOMER Acc_N
e
Acc_n o
Credit
o Transfer
Debit
Cust_i
To_Accnt
d amt
Ch
ec
ks
M
Pa ake
ym s
en date
t Servivce Bill
Acc_N
Due_Date
o

Bill amt

Provider Acc

Acc_N
o
Cust_No Bill amt

Fig10: ER Diagram

Relational Tables:

20
Customer:

Cheque Status (ChqStat):

Loan Status (LoanStat):

Locker Status (Locker):

21
Deposit Status (DepStat):

Login:

Hippo Chart:

22
J2ME

Login

Welcome to Mobile Banking

Check Check Check Check Perform Check


Balance Cheque Loan Due Deposit Fund Locker
Status Status Transfer Status

Acc Cheque Deposit Locker


Loan Id
Number Number Number Number

From and
to acc no Display
Display Display Display Display
Locker
Balance Status Loan Due Deposit
Status
Status

Basic Algorithms/Procedures/Methods/Logic:

23
The project is an integration of Web (J2EE) and Mobile (J2ME) technology.
Hence the basic logic is to find a solution which would provide customer the basic
services from bank using these two technologies together.

J2ME:
Java Platform, Micro Edition (Java ME) provides a robust, flexible environment
for applications running on mobile and other embedded devices—mobile phones,
personal digital assistants (PDAs), TV set-top boxes, and printers. Java ME includes
flexible user interfaces, robust security, built-in network protocols, and support for
networked and offline applications that can be downloaded dynamically. Applications
based on Java ME are portable across many devices, yet leverage each device's native
capabilities.

J2EE:
Java EE is defined by its specification. As with other Java Community Process
specifications, Java EE is also considered informally to be a standard since providers
must agree to certain conformance requirements in order to declare their products as Java
EE compliant; albeit with no ISO or ECMA standard.
Java EE also features some specifications unique to Java EE for components.
These include Enterprise JavaBeans, servlets, portlets (following the Java Portlet
specification), JavaServer Pages and several web service technologies. This allows
developers to create enterprise applications that are portable and scalable, and that
integrate with legacy technologies. A Java EE "application server" can handle the
transactions, security, scalability, concurrency and management of the components that
are deployed to it, meaning that the developers can concentrate more on the business
logic of the components rather than on infrastructure and integration tasks.

Description of Algorithms/Procedures/Methods/Logic:

24
Java ME has become a popular option for creating applications and games for cell
phones, as they can be emulated on a PC during the development stage and easily
uploaded to phones. This contrasts with the difficulty of developing, testing, and loading
applications and gaming for other special gaming platforms such as those made by
Nintendo, Sony, Microsoft, and others, as expensive system-specific hardware and kits
are required.
Java ME devices implement a profile. The most common of these are the Mobile
Information Device Profile aimed at mobile devices, such as cell phones, and the
Personal Profile aimed at consumer products and embedded devices like Set-top boxes
and PDAs.Profiles are subsets of configurations, of which there are currently two: the
Connected Limited Device Configuration and the Connected Device Configuration.

CLDC:
The Connected Limited Device Configuration (CLDC) defines the base set of
application programming interfaces and a virtual machine for resource-constrained
devices like mobile phones, pagers, and mainstream personal digital assistants. When
coupled with a profile such as the Mobile Information Device Profile (MIDP), it provides
a solid Java platform for developing applications to run on devices with limited memory,
processing power, and graphical capabilities.

J2ME API’s used:


• java.io :
A streamlined version of the java.io package found in the standard edition for
doing Input/Output operations.

• javax.microedition.midlet

The MIDlet package defines Mobile Information Device Profile applications and
the interactions between the application and the environment in which the
application runs. An application of the Mobile Information Device Profile is a
MIDlet.

The following definitions are used in the MIDlet lifecycle:

o Application management software - a part of the device's software


operating environment that manages MIDlets. It directs the MIDlet
through state changes.
o MIDlet - a MIDP application on the device. The MIDlet can signal the
application management software about whether is it wants to run or has
completed. A MIDlet has no knowledge of other MIDlets through the
MIDlet API.
o MIDlet States - the states a MIDlet can have are defined by the transitions
allowable through the MIDlet interface. More specific application states
are known only to the application.

25
• javax.microedition.lcdui

The UI API provides a set of features for implementation of user interfaces for
MIDP applications.

Java Platform, Enterprise Edition (Java EE) builds on the solid foundation of Java
Platform, Standard Edition (Java SE) and is the industry standard for implementing
enterprise-class service-oriented architecture (SOA) and next-generation web
applications.

26
Java Platform, Enterprise Edition (Java EE) is a set of coordinated technologies
that significantly reduces the cost and complexity of developing, deploying, and
managing multitier, server-centric applications. Building on the Java Platform, Standard
Edition (Java SE), Java EE adds the capabilities that provide a complete, stable, secure,
and fast Java platform for the enterprise.

J2EE API’s used:

• javax.servlet :

The javax.servlet package contains a number of classes and interfaces that


describe and define the contracts between a servlet class and the runtime environment
provided for an instance of such a class by a conforming servlet container.
The Servlet API, contained in the Java package hierarchy javax.servlet,
defines the expected interactions of a Web container and a servlet. A Web container
is essentially the component of a Web server that interacts with the servlets. The Web
container is responsible for managing the lifecycle of servlets, mapping a URL to a
particular servlet and ensuring that the URL requester has the correct access rights.
A Servlet is an object that receives a request and generates a response based on
that request. The basic servlet package defines Java objects to represent servlet
requests and responses, as well as objects to reflect the servlets configuration
parameters and execution environment.
Lifecycle of a Servlet

The Servlet lifecycle consists of the following steps:

1. The Servlet class is loaded by the container during start-up.


2. The container calls the init() method. This method initializes the servlet and
must be called before the servlet can service any requests. In the entire life of a
servlet, the init() method is called only once.
3. After initialization, the servlet can service client-requests. Each request is serviced
in its own separate thread. The container calls the service() method of the
servlet for every request. The service() method determines the kind of request
being made and dispatches it to an appropriate method to handle the request. The
developer of the servlet must provide an implementation for these methods. If a
request for a method that is not implemented by the servlet is made, the method of
the parent class is called, typically resulting in an error being returned to the
requester.
4. Finally, the container calls the destroy() method which takes the servlet out of
service. The destroy() method like init() is called only once in the lifecycle of
a Servlet.

• java.sql:

27
Provides the API for accessing and processing data stored in a data source
(usually a relational database) using the Java programming language. This API
TM

includes a framework whereby different drivers can be installed dynamically to


access different data sources. Although the JDBC API is mainly geared to
TM

passing SQL statements to a database, it provides for reading and writing data
from any data source with a tabular format. The reader/writer facility, available
through the javax.sql.RowSet group of interfaces, can be customized to use and
update data from a spread sheet, flat file, or any other tabular data source.

• java.io

Provides for system input and output through data streams, serialization
and the file system. Unless otherwise noted, passing a null argument to a
constructor or method in any class or interface in this package will cause a
NullPointerException to be thrown.

• java.util

Provides for system input and output through data streams, serialization
and the file system. Unless otherwise noted, passing a null argument to a
constructor or method in any class or interface in this package will cause a
NullPointerException to be thrown.

28
User Manual

29
About software:
The user would be provided with an executable jar file which
would help him connect the web server to get the required service.

How to use the software:

In Simulation Model:

 Service Provider End:


a. Start the Tomcat Server.

 User End:
a. Open the Java wireless toolkit.
b. Select MBS as the project.
c. Build and Run it.
d. Login with the correct username and password.
e. Select the service required and get the reply from
the provider.

In Real-Life Model:

 Service Provider End:


a. Let the class files of the servlets be put up in the
application folder of the web server which supports
processing of j2ee.
b. Start the web server on the host.

 User End:
a. Run the jar file on a mobile phone which supports
java.
b. Log in with a correct username and password to
access the services provided.
c. After logging in, select the required service.

30
Importance of the project:
The idea that mobile phones bring economic benefits is now widely accepted. In
places with bad roads, few trains and parlous land lines, they substitute for travel, allow
price data to be distributed more quickly and easily, enable traders to reach wider markets
and generally ease the business of doing business.
With mobile banking, the customer may be sitting in any part of the world (a true
anytime, anywhere banking) and hence banks need to ensure that the systems are up and
running in a true 24 x 7 fashion.

31
Further
Enhancemen
t

32
M-banking schemes can be combined with microfinance loans, extending access to credit
and enabling users to establish a credit history

Mobile banking can offer services such as the following:

Account Information

Mini-statements and checking of account history

Alerts on account activity or passing of set thresholds

Monitoring of term deposits

Access to loan statements

Access to card statements

Mutual funds / equity statements

Insurance policy management

Pension plan management

Status on cheque, stop payment on cheque

Payments & Transfers

Domestic and international fund transfers

Mobile recharging

Bill payment processing

Peer to Peer payments

Investments

Portfolio management services

Real-time stock quotes

33
Personalized alerts and notifications on security prices

Support

Status of requests for credit, including mortgage approval, and insurance coverage

Check (cheque) book and card requests

Exchange of data messages and email, including complaint submission and tracking

ATM Location

Content Services

General information such as weather updates, news

Loyalty-related offers

Location-based services

34
Appendix

Source Code:

MBS.java:
import javax.microedition.lcdui.*;
import javax.microedition.midlet.*;
public class MBS extends MIDlet
{
String sn=null;
MLogin mlogin;
CheckBal chkbal;
CheqStat chqstat;
DepDet depdet;
FundTran fundtran;
LoanStat loanstat;
LockStat lockstat;
MainMenu mm;
public MBS()

35
{
mlogin = new MLogin(this);
chkbal = new CheckBal(this);
chqstat = new CheqStat(this);
depdet = new DepDet(this);
fundtran = new FundTran(this);
loanstat = new LoanStat(this);
lockstat = new LockStat(this);
mm=new MainMenu(this);
}
public void mlogin()
{
Display.getDisplay(this).setCurrent(mlogin);
}
public void chkbal()
{
Display.getDisplay(this).setCurrent(chkbal);
}
public void chqstat()
{
Display.getDisplay(this).setCurrent(chqstat);
}
public void depdet()
{
Display.getDisplay(this).setCurrent(depdet);
}

public void fundtran()


{
Display.getDisplay(this).setCurrent(fundtran);
}
public void loanstat()
{
Display.getDisplay(this).setCurrent(loanstat);
}
public void lockstat()
{
Display.getDisplay(this).setCurrent(lockstat);
}
public void mm()
{ mm.setTitle("Welcome "+sn);
Display.getDisplay(this).setCurrent(mm);
}

public void startApp()

36
{
Display.getDisplay(this).setCurrent(mlogin);
}
public void pauseApp()
{
}
public void destroyApp(boolean b)
{
}
public void quit()
{
destroyApp(false);
notifyDestroyed();
}
public String callServlet(String servname,String param,String disp)
{
String response="Error";
ConnectWait cw=new ConnectWait(this,disp);
response=cw.callServlet(servname,param);
return response;
}
};

MainMenu.java:
import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;

public class MainMenu extends List implements CommandListener


{

private final MBS mbs;


private final Command logout;

public MainMenu(MBS mbs)


{
super(" Welcome to Mobile Banking ", List.IMPLICIT);
this.mbs=mbs;

logout = new Command("Logout", Command.EXIT, 1);


addCommand(logout);

37
append("Check Balance",null);
append("Check Cheque Status",null);
append("Check Deposit Status",null);
append("Perform Fund Transfer",null);
append("Check Loan Due",null);
append("Check Locker Status",null);
setCommandListener(this);
}

public void commandAction(Command cmd, Displayable d)


{
if(cmd == List.SELECT_COMMAND)
{
if(getString(getSelectedIndex()).equals("Check
Balance"))mbs.chkbal();
if(getString(getSelectedIndex()).equals("Check Cheque Status"))
mbs.chqstat();
if(getString(getSelectedIndex()).equals("Check Deposit
Status"))mbs.depdet();
if(getString(getSelectedIndex()).equals("Perform Fund
Transfer"))mbs.fundtran() ;
if(getString(getSelectedIndex()).equals("Check Loan
Due"))mbs.loanstat();
if(getString(getSelectedIndex()).equals("Check Locker
Status"))mbs.lockstat();
}
else if(cmd == logout)

{
Display.getDisplay(mbs).setCurrent(mbs.mlogin);
mbs.mlogin.tfuser.setString("");
mbs.mlogin.tfpwd.setString("");
}
}
}

Mlogin.java:

import javax.microedition.lcdui.*;
import javax.microedition.io.*;
import java.io.*;

public class MLogin extends Form implements CommandListener


{
private final MBS mbs;

38
private Command login,exit;
TextField tfuser,tfpwd;
private String response,sn,sp;
private StringItem si;

public MLogin(MBS mbs)


{

super("Login form");
this.mbs=mbs;

tfuser = new TextField("Username",null,10,TextField.ANY);


tfpwd = new TextField("Password",null,10,TextField.PASSWORD);
si=new StringItem(null,"Logging in......... ");

login = new Command("Login",Command.SCREEN,1);


exit = new Command("Exit",Command.EXIT,2);

append(si);
append(tfuser);
append(tfpwd);
addCommand(login);
addCommand(exit);

setCommandListener(this);
}

public void commandAction(Command comm, Displayable d1)


{
if(comm==exit)
{
mbs.quit();
}
if (comm == login)
{
sn = tfuser.getString();
sp = tfpwd.getString();

if(sn.equals("") && sp.equals(""))


{
Display.getDisplay(mbs).setCurrent(new
Alert("Error", "You have not entered Loginname and Password", null,
AlertType.ERROR));
}
else if(sn.equals(""))

39
{
Display.getDisplay(mbs).setCurrent(new
Alert("Error", "You have not entered Loginname", null, AlertType.ERROR));
}
else if(sp.equals(""))
{
Display.getDisplay(mbs).setCurrent(new
Alert("Error", "You have not entered Password", null, AlertType.ERROR));
}
else
{
String sname="MLogin";
String
sparam="LoginName="+sn+"&Password="+sp;
String
res=mbs.callServlet(sname,sparam,"Logging in....");

char d=res.charAt(0);
if(!res.equals("Error"))
{
if(d=='W')
{
mbs.sn=tfuser.getString();
mbs.mm();
}
else
{
tfpwd.setString("");

Display.getDisplay(mbs).setCurrent(new Alert("Error", "Invalid Loginname


and/or Password", null, AlertType.ERROR));
}
}
//return response;
}
}
}//command action closing
}

LockStat.java:

import javax.microedition.lcdui.*;
import javax.microedition.io.*;
import java.io.*;

40
public class LockStat extends Form implements CommandListener
{
private MBS mbs;
private TextField tflockno;
private Command getlkstat,back;
private String response,lc;
private Form disp;
private StringItem dsi;

public LockStat(MBS mbs)


{
super(" Locker Status");
this.mbs=mbs;

tflockno = new TextField("Enter Locker Number",null,7,TextField.ANY);


getlkstat = new Command("Get Locker Status",Command.SCREEN,1);
back = new Command("Back",Command.EXIT,1);

append(tflockno);
addCommand(getlkstat);
addCommand(back);

setCommandListener(this);

disp=new Form("Locker Info");


dsi=new StringItem("","");
disp.append(dsi);
disp.addCommand(back);
disp.setCommandListener(this);
}

public void commandAction(Command comm, Displayable d1)


{
if (comm == getlkstat)
{
lc = tflockno.getString();
if(lc.equals(""))
{
Display.getDisplay(mbs).setCurrent(new Alert("Error",
"You have not entered Locker Number", null, AlertType.ERROR));
}
else if(lc.length()<5)
{

41
Display.getDisplay(mbs).setCurrent(new Alert("Error",
"Please Enter a 5 digit Number", null, AlertType.ERROR));
}
else if(lc.length()>5)
{
Display.getDisplay(mbs).setCurrent(new Alert("Error",
"The Locker Number Should be 5 digits only ", null, AlertType.ERROR));
}
else
{
String sname="MLockStat";
String sparam="lockid="+lc;
String res=mbs.callServlet(sname,sparam,"Locker
Status....");

dsi.setText(res);
Display.getDisplay(mbs).setCurrent(disp);
}
}

if (comm == back)
{
Display.getDisplay(mbs).setCurrent(mbs.mm);
tflockno.setString("");
}

}
}

LoanStat.java:
import javax.microedition.lcdui.*;
import javax.microedition.io.*;
import java.io.*;

public class LoanStat extends Form implements CommandListener


{
private MBS mbs;
private TextField tfloanno;
private Command getlnstat,back;
private String response,ln;
private Form disp;
private StringItem dsi;

public LoanStat(MBS mbs)


{
super(" Loan Status");

42
this.mbs=mbs;

tfloanno = new TextField("Enter Loan Number",null,7,TextField.ANY);

getlnstat = new Command("Get Loan Status",Command.SCREEN,1);


back = new Command("Back",Command.EXIT,2);

append(tfloanno);
addCommand(getlnstat);
addCommand(back);

setCommandListener(this);

disp=new Form("Loan Info");


dsi=new StringItem("","");
disp.append(dsi);
disp.addCommand(back);
disp.setCommandListener(this);
}

public void commandAction(Command comm, Displayable d1)


{
if (comm == getlnstat)
{
ln = tfloanno.getString();
if(ln.equals(""))
{
Display.getDisplay(mbs).setCurrent(new Alert("Error",
"You have not entered Loan Number", null, AlertType.ERROR));
}
if (ln.length()>5)
{
Display.getDisplay(mbs).setCurrent(new Alert("Error",
"Loan Number is too long ", null, AlertType.ERROR));
}
else if (ln.length()<5)
{
Display.getDisplay(mbs).setCurrent(new Alert("Error",
"Loan Number is less than 5 Digits ", null, AlertType.ERROR));
}
else
{
String sname="MLoanStat";
String sparam="loanno="+ln;
String res=mbs.callServlet(sname,sparam,"Loan
Status....");

43
dsi.setText(res);
Display.getDisplay(mbs).setCurrent(disp);
}
}
if (comm == back)
{
Display.getDisplay(mbs).setCurrent(mbs.mm);
tfloanno.setString("");
}

}
}

FundTran:

import javax.microedition.lcdui.*;
import javax.microedition.io.*;
import java.io.*;

public class FundTran extends Form implements CommandListener


{
private MBS mbs;
private Command tfrfund,back;
private TextField tfrtoacc,tframt;
private String response,sn,amt;
private Form disp;
private StringItem dsi;

public FundTran(MBS mbs)


{
super(" Transfer of Funds");
this.mbs=mbs;
tfrfund = new Command("Transfer Fund",Command.SCREEN,1);
back = new Command("Back",Command.EXIT,2);
tfrtoacc = new TextField("Transfer to Account",null,10,TextField.ANY);
tframt = new TextField("Amount to
transfer",null,10,TextField.NUMERIC);

append(tfrtoacc);
append(tframt);
addCommand(tfrfund);
addCommand(back);

setCommandListener(this);
disp=new Form("Transfer Info");

44
dsi=new StringItem("","");
disp.append(dsi);
disp.addCommand(back);
disp.setCommandListener(this);
}

public void commandAction(Command comm, Displayable d1)


{
if (comm == tfrfund)
{
sn = tfrtoacc.getString();
amt = tframt.getString();
if(sn.equals("") && amt.equals(""))
{
Display.getDisplay(mbs).setCurrent(new
Alert("Error", "You have not entered Accountno and Amount", null,
AlertType.ERROR));
}
else if(sn.equals(""))
{
Display.getDisplay(mbs).setCurrent(new
Alert("Error", "You have not entered Accountno", null, AlertType.ERROR));
}
else if(amt.equals(""))

{
Display.getDisplay(mbs).setCurrent(new
Alert("Error", "You have not entered Amount", null, AlertType.ERROR));
}
else
{
int toamt=Integer.parseInt(amt);
String sname="MFundTran";
String
sparam="faccn="+sn+"&famt="+toamt;
String
res=mbs.callServlet(sname,sparam,"Fund Transfer Screen");

dsi.setText(res);
Display.getDisplay(mbs).setCurrent(disp);
}
}

if (comm == back)

45
{
Display.getDisplay(mbs).setCurrent(mbs.mm);
tfrtoacc.setString("");
tframt.setString("");
}
}
}

DepDet.java:
import javax.microedition.lcdui.*;
import javax.microedition.io.*;
import java.io.*;

public class DepDet extends Form implements CommandListener


{
private MBS mbs;
private Command getdepdet,back;
private TextField tfdepno;
private String response,ndep;
private Form disp;
private StringItem dsi;

public DepDet(MBS mbs)


{
super("Deposit Status");
this.mbs=mbs;

getdepdet = new Command("Get Status",Command.SCREEN,1);


back = new Command("Back",Command.EXIT,2);
tfdepno = new TextField("Deposit Number ",null,7,TextField.ANY);

append(tfdepno);
addCommand(getdepdet);
addCommand(back);

setCommandListener(this);

disp=new Form("Deposit Info");


dsi=new StringItem("","");
disp.append(dsi);
disp.addCommand(back);

46
disp.setCommandListener(this);
}

public void commandAction(Command comm, Displayable d1)


{
if (comm == getdepdet)
{
ndep = tfdepno.getString();
if(ndep.equals(""))
{
Display.getDisplay(mbs).setCurrent(new Alert("Error",
"You have not entered Deposit Number", null, AlertType.ERROR));
}
if (ndep.length()<6)
{
Display.getDisplay(mbs).setCurrent(new Alert("Error",
"Please Enter Proper Deposit Number ", null, AlertType.ERROR));

}
else if(ndep.length()>6)
{
Display.getDisplay(mbs).setCurrent(new Alert("Error",
"Deposit Number is too Long ", null, AlertType.ERROR));
}
else
{
String sname="MDepDet";
String sparam="depno="+ndep;
String res=mbs.callServlet(sname,sparam,"Deposit
Details....");

dsi.setText(res);
Display.getDisplay(mbs).setCurrent(disp);

}
}
if (comm == back)
{
Display.getDisplay(mbs).setCurrent(mbs.mm);
tfdepno.setString("");
}

}
}

47
ConnectWait.java:

import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;
import java.io.*;
import javax.microedition.io.*;

public class ConnectWait extends Canvas implements Runnable


{
private final MBS mbs;
private final String servbase="http://localhost:8080/servlet/";
private String msg;
private String servname,param,response;

ConnectWait(MBS mbs)
{
this.mbs=mbs;
msg = "Please Wait...";
repaint();
serviceRepaints();
}

ConnectWait(MBS mbs,String msg)


{
this.mbs=mbs;
this.msg = msg;
repaint();
serviceRepaints();
}

public void paint(Graphics g)


{
System.out.println("paint");
g.setColor(0xffffff);
g.fillRect(0, 0, getWidth(), getHeight());
g.setColor(0xff0000);
g.drawString(msg, getWidth()/2, getHeight()/2, Graphics.TOP|
Graphics.HCENTER);
}

public String callServlet(String servname,String param)


{
response="Error";
this.servname=servname;
this.param=param;

48
Thread t = new Thread(this);
t.start();
try
{
t.join();
}
catch(InterruptedException e)
{
response="Error";
}
if(response.equals("Error"))
Display.getDisplay(mbs).setCurrent(new Alert("Sorry", "Error in
Connection. Try Later", null, AlertType.ERROR));

return response;
}

public void run()


{
HttpConnection http=null;
InputStream is=null;
try
{
// Call Servlet
System.out.println(servname+" "+" apeksha 1called");

http=(HttpConnection)Connector.open(servbase+servname+"?"+param);
System.out.println("2");
http.setRequestMethod(HttpConnection.GET);
System.out.println("3");
http.setRequestProperty("Content-Type","application/x-www-
form-urlencoded");
System.out.println("4");

// Get Response
is=http.openInputStream();
System.out.println("5");
ByteArrayOutputStream baos=new ByteArrayOutputStream();
System.out.println("6");
int ch;
while((ch=is.read())!=-1)
{
baos.write(ch);
}
String str=new String(baos.toByteArray());
baos.close();

49
response=str.trim();
}
catch(IOException e)
{
response="Error";
}
finally
{
try { if(http!=null) http.close(); } catch(IOException ignored)
{}
try { if(is!=null) is.close();} catch(IOException ignored) {}
}
}
};

CheqStat.java:

import javax.microedition.lcdui.*;
import javax.microedition.midlet.*;
import javax.microedition.io.*;
import java.io.*;

public class CheqStat extends Form implements CommandListener


{
private MBS mbs;
private TextField tfchqstat;
private Command back,check;
private String response,sn;
private Form disp;
private StringItem dsi;

public CheqStat(MBS mbs)


{

50
super("Cheque Information");
this.mbs=mbs;

tfchqstat = new TextField("Cheque


Number",null,10,TextField.NUMERIC);
back = new Command("Back",Command.EXIT,2);
check = new Command("Check",Command.SCREEN,1);

append(tfchqstat);
addCommand(check);
addCommand(back);

setCommandListener(this);

disp=new Form("Cheque Info");


dsi=new StringItem("","");
disp.append(dsi);
disp.addCommand(back);
disp.setCommandListener(this);

public void commandAction(Command comm, Displayable d)


{
if (comm == check)
{
sn = tfchqstat.getString();
if(sn.equals(""))
{
Display.getDisplay(mbs).setCurrent(new Alert("Error",
"You have not entered Cheque Number", null, AlertType.ERROR));
}
if (sn.length()<6)
{
Display.getDisplay(mbs).setCurrent(new Alert("Error",
"The Cheque Number is less than required", null, AlertType.ERROR));
}
else if (sn.length()>6)
{
Display.getDisplay(mbs).setCurrent(new Alert("Error",
"The Cheque No. Should not be more than 6 Digits", null, AlertType.ERROR));
}
else
{
int sno=Integer.parseInt(sn);
String sname="MCheqStat";

51
String sparam="cno="+sno;
String
res=mbs.callServlet(sname,sparam,"Cheque Status....");

dsi.setText(res);
Display.getDisplay(mbs).setCurrent(disp);
}
}
if(comm == back)
{
Display.getDisplay(mbs).setCurrent(mbs.mm);
tfchqstat.setString("");
}
}
}

CheckBal.java:

import javax.microedition.lcdui.*;
import javax.microedition.io.*;
import java.io.*;

public class CheckBal extends Form implements CommandListener


{
private final MBS mbs;
private TextField accno;
private Command getbal, back;
private Form disp;
private StringItem dsi;
private String sn;

public CheckBal(MBS mbs)


{
super("Balance Information");
this.mbs=mbs;

getbal = new Command("GetBal",Command.SCREEN,1);


back = new Command("Back",Command.EXIT,2);

accno = new TextField("Account Number",null,10,TextField.ANY);

append(accno);
addCommand(getbal);
addCommand(back);
setCommandListener(this);

52
disp=new Form("Bal Info");
dsi=new StringItem("","");
disp.append(dsi);
disp.addCommand(back);
disp.setCommandListener(this);
}

public void commandAction(Command comm, Displayable d)


{
if (comm == getbal)
{
sn = accno.getString();
if(sn.equals(""))
{
Display.getDisplay(mbs).setCurrent(new
Alert("Error", "You have not entered Account Number", null, AlertType.ERROR));
accno.setString("");
}
else if(sn.length()<5)
{
Display.getDisplay(mbs).setCurrent(new Alert("Error",
"Please Enter a 5 digit Number", null, AlertType.ERROR));
}
else if(sn.length()>5)
{
Display.getDisplay(mbs).setCurrent(new Alert("Error",
"The Account Number Should be 5 digits only ", null, AlertType.ERROR));
}
else
{
String sname="MCheckBal";
String sparam="accno="+sn;
String res=mbs.callServlet(sname,sparam,"Balance
Info....");
if (res.charAt(0)=='T')
{
dsi.setText(res);
Display.getDisplay(mbs).setCurrent(disp);
}
else
{
dsi.setText(res);
Display.getDisplay(mbs).setCurrent(disp);
}
}
}

53
if (comm==back)
{
Display.getDisplay(mbs).setCurrent(mbs.mm);
accno.setString("");
}
}
}

Bank.java

public class Bank


{
private static String dsn="jdbc:odbc:Bank";
private static String htmlBase="http://localhost:8080/public_html/";
private static String hbase="http://localhost:8080/";
private static String servletBase="http://localhost:8080/servlet/";

public static String getDsn() {return dsn; }


public static String getHtmlBase() {return htmlBase; }
public static String gethbase(){return hbase;}
public static String getServletBase() {return servletBase; }
}

MLogin.java:

import java.sql.*;
import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;

public class MLogin extends HttpServlet


{
String l,p;
Connection c;
Statement s;
ResultSet rs;
PrintWriter out;

public void doPost(HttpServletRequest req,HttpServletResponse res) throws


ServletException, IOException
{

54
res.setContentType("text/html");
out = res.getWriter();
ServletContext context= getServletContext();
l = req.getParameter("LoginName");
p = req.getParameter("Password");
try
{

DriverManager.registerDriver(new
sun.jdbc.odbc.JdbcOdbcDriver());
c=DriverManager.getConnection(Bank.getDsn());
s = c.createStatement();
rs=s.executeQuery("select * from Login where LoginName
='"+l+"' and Password='"+p+"'");
if(rs.next())
{
out.println("Welcome to Mobile Banking System ,"+l+"");
context.setAttribute("Accno",rs.getString("Acc_no"));
}
else
{
out.println("Invalid Login/Password.");
}
}
catch(Exception e)
{
out.println("Error"); }
finally
{
try
{
if(c!=null) c.close();
}
catch(SQLException igno)
{
}
}
}

public void doGet(HttpServletRequest req,HttpServletResponse res) throws


IOException,ServletException
{
doPost(req,res);
}

55
MCheckBal.java:

import java.sql.*;
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;

public class MCheckBal extends HttpServlet


{
String accn,acct;
Connection c;
Statement s;
ResultSet rs;
PrintWriter out;

public void doGet(HttpServletRequest req,HttpServletResponse res) throws


ServletException, IOException
{
doPost(req,res);
}
public void doPost(HttpServletRequest req,HttpServletResponse res) throws
ServletException, IOException
{
res.setContentType("text/html");
out = res.getWriter();
ServletContext context=getServletContext();
accn=req.getParameter("accno");
try
{
DriverManager.registerDriver(new
sun.jdbc.odbc.JdbcOdbcDriver());
c=DriverManager.getConnection(Bank.getDsn());
s = c.createStatement();
rs=s.executeQuery("select * from Customer where
Acc_no='"+accn+"'");
String sameacc= (String)context.getAttribute("Accno");

if (rs.next() && (sameacc.equals(accn)))


{
out.println("The Name of the Account Holder is :
"+rs.getString("Name"));
out.println("Account Type is : "+rs.getString("Acc_type"));
out.println("Your Balance is : "+rs.getInt("Balance"));
}

56
else
{
out.println("Invalid Account Number.Please Enter Proper
Account Number.");
}
}
catch(Exception e)
{
//e.getMessage();
System.out.println("ERROR");
}
finally
{
try
{
if(c!=null) c.close();
}
catch(SQLException igno)
{
}
}
}
}

MCheqStat.java:

import java.sql.*;
import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;
import java.util.*;
public class MCheqStat extends HttpServlet
{
String acn,ckno,amt,d,sss;
java.util.Date dep,ds;
StringTokenizer st;
Connection c,con;
Statement s,s1;
ResultSet rs,rs1,rs2;
PrintWriter out;
int diff;
public void doGet(HttpServletRequest req,HttpServletResponse res) throws
ServletException, IOException

57
{
doPost(req,res);
}
public void doPost(HttpServletRequest req,HttpServletResponse res) throws
ServletException, IOException
{
ServletContext context=getServletContext();
res.setContentType("text/html");
out=res.getWriter();
ckno=req.getParameter("cno");
ds=new java.util.Date();
try
{
DriverManager.registerDriver(new
sun.jdbc.odbc.JdbcOdbcDriver());
c=DriverManager.getConnection(Bank.getDsn());
con=DriverManager.getConnection(Bank.getDsn());
s=c.createStatement();
s1=con.createStatement();
int cckno=Integer.parseInt(ckno);
rs=s.executeQuery("select * from Chqstatus where
Chqno="+cckno+"");
String sameacc= (String)context.getAttribute("Accno");
if (rs.next())
{
acn=rs.getString("Acc_no");

int amtn=rs.getInt("Amt");

String deps=(rs.getDate("Depdate")).toString();

st = new StringTokenizer(deps,"-");

String y=st.nextToken();
String m=st.nextToken();
String da=st.nextToken();

int i1=Integer.parseInt(y);
int i2=Integer.parseInt(m);
int i3=Integer.parseInt(da);

dep=new java.util.Date(i1-1900,i2-1,i3);
diff=(ds.getDate()-dep.getDate());

if ( (diff<=2) && (i1==ds.getYear()+1900) &&


(i2==ds.getMonth()+1) )

58
{
out.println("Your Cheque dated "+dep+" has been
presented for Clearance");
}
else
if ((diff>=3) && (i2==ds.getMonth()+1) &&
(i1==ds.getYear()+1900) )
{
String acnd=rs.getString("Acc_no");
rs1=s.executeQuery("select * from
Customer where Acc_no='"+acnd+"'");
rs2=s1.executeQuery("select * from
Chqstatus where Chqno="+cckno+"");
if (rs2.next())
{
sss=rs2.getString("Stat");
}
(rs1.next() && (!sss.equalsIgnoreCase("Cleared")) )
{
out.println("Your
Cheque dated "+dep+"has been Cleared ");
out.println("The
amount credited to your account is :"+amtn+"");
int
cre=rs1.getInt("Credit");
int
bal=rs1.getInt("Balance");
int ncre=amtn+cre;
int nbal=amtn+bal;
String cs="Cleared";

s.executeUpdate("update Customer set Credit="+ncre+", Balance="+nbal+"


where Acc_no='"+acnd+"'");

s1.executeUpdate("update Chqstatus set Stat='"+cs+"' where Chqno="+ckno+"


and Acc_no='"+acnd+"'");
}
else
{
out.println("You
Cannot perform this action ");
out.println("Your
Money is already Credited... "); }

}
else

59
{
out.println(" Check Account Number or Cheque
Number.. ");}
}
else
{
out.println("Invalid Data Entry ");
}
}
catch(Exception e)
{
System.out.println(e.getMessage());
// e.printStackTrace();
}
finally
{
try
{
if(c!=null) c.close();
if(con!=null) con.close();
}
catch(SQLException igno)
{
}
}
}
}
MDepDet.java:

import java.sql.*;
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
import java.util.*;

public class MDepDet extends HttpServlet


{
String acc,dep;
java.util.Date depd,depmd,ds;
StringTokenizer st;
Connection c;
Statement s;
ResultSet rs;
PrintWriter out;
boolean c1;

60
public void doGet(HttpServletRequest req,HttpServletResponse res) throws
ServletException, IOException
{
doPost(req,res);
}
public void doPost(HttpServletRequest req,HttpServletResponse res) throws
ServletException, IOException
{
res.setContentType("text/html");
out=res.getWriter();

dep=req.getParameter("depno");

try
{
DriverManager.registerDriver(new
sun.jdbc.odbc.JdbcOdbcDriver());
c=DriverManager.getConnection(Bank.getDsn());
s=c.createStatement();

rs=s.executeQuery("select * from Depstat where Deposit_no


='"+dep+"'");

if (rs.next())
{
java.util.Date depd=rs.getDate("Idate");
String id=rs.getString("Deposit_no");
String mats=(rs.getDate("Mdate")).toString();

st=new StringTokenizer(mats,"-");
String y=st.nextToken();
String m=st.nextToken();
String da=st.nextToken();

int y1=Integer.parseInt(y);
int m1=Integer.parseInt(m);
int da1=Integer.parseInt(da);

depmd=new java.util.Date(y1-1900,m1-1,da1);
ds=new java.util.Date();

c1= depmd.before(ds);

if ((id.equalsIgnoreCase(dep)) &&
(c1==true) )

61
{
out.println("Investment
Dated "+depd+" has matured.");
out.println("The Maturity
Amount is :"+rs.getInt("Maturedamt")+" @ "+rs.getInt("RateofInterest") + " for a period
of "+rs.getInt("Period")+" months");
}
else
{
out.println("Your Deposit's are yet
to Mature.");
}
}
else
{
out.println("Check the Deposit Number");

}
}
catch(Exception e)
{
System.out.println(e.getMessage());
}
finally
{
try
{
if(c!=null) c.close();
}
catch(SQLException igno)
{
}
}
}

MFundTran.java:

import java.sql.*;
import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;

public class MFundTran extends HttpServlet

62
{
String fac,fam;
Connection c;
Statement s;
ResultSet rs,rs1;
PrintWriter out;
int ideb,ibal;

public void doGet(HttpServletRequest req,HttpServletResponse res) throws


ServletException, IOException
{
doPost(req,res);
}

public void doPost(HttpServletRequest req,HttpServletResponse res) throws


ServletException, IOException
{
res.setContentType("text/html");
out = res.getWriter();
ServletContext context=getServletContext();

fac=req.getParameter("faccn");
fam=req.getParameter("famt");
int ifam=Integer.parseInt(fam);

try
{
DriverManager.registerDriver(new
sun.jdbc.odbc.JdbcOdbcDriver());
c=DriverManager.getConnection(Bank.getDsn());
s = c.createStatement();

String sameacc= (String)context.getAttribute("Accno");

rs1=s.executeQuery("select * from Customer where


Acc_no='"+sameacc+"'");
if (rs1.next())
{
ideb=rs1.getInt("Debit");
ibal=rs1.getInt("Balance");
}

boolean b=sameacc.equalsIgnoreCase(fac);
if (b==false && ibal>ifam)

63
{
rs=s.executeQuery("select * from Customer
where Acc_no='"+fac+"'");
if (rs.next())
{
int cre=rs.getInt("Credit");
int bal=rs.getInt("Balance");

int ncre=ifam+cre;
int nbal=ifam+bal;

int ndeb=ifam+ideb;
int nbalan=ibal-ifam;

s.executeUpdate("update Customer
set Credit="+ncre+", Balance="+nbal+" where Acc_no='"+fac+"'");
s.executeUpdate("update Customer
set Debit="+ndeb+", Balance="+nbalan+" where Acc_no='"+sameacc+"'");

out.println("The Transfer of Funds to


"+fac+" is Complete.");
out.print("Money transfered
was :"+ifam);

}
else
{

out.println("Invalid Data Entry");

}
}
else
{
out.println("You Can't Transfer Money to
your own account");
out.println("Or You don't have sufficient
funds to perform transfer");
}

}
catch(Exception e)
{
System.out.println(e.getMessage());
}
finally

64
{
try
{
if(c!=null) c.close();
}
catch(SQLException igno)
{
}
}

}
}

MLoanStat.java:

import java.sql.*;
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;

public class MLoanStat extends HttpServlet


{
String accc,lid;
Connection c;
Statement s;
ResultSet rs;
PrintWriter out;

public void doGet(HttpServletRequest req,HttpServletResponse res) throws


ServletException, IOException
{
doPost(req,res);
}

public void doPost(HttpServletRequest req,HttpServletResponse res) throws


ServletException, IOException
{
res.setContentType("text/html");
out=res.getWriter();
ServletContext context=getServletContext();
lid=req.getParameter("loanno");
try
{
DriverManager.registerDriver(new
sun.jdbc.odbc.JdbcOdbcDriver());

65
c=DriverManager.getConnection(Bank.getDsn());
s=c.createStatement();
rs=s.executeQuery("select * from loanstat where
Loanid='"+lid+"'");
if (rs.next())
{
int z=rs.getInt("Dueamt");
if (z==0)
out.println("All your loan is paid ");
else
out.println("Your Loan Status i.e. due amount
is:"+"RS."+z+"");
}
else
{
out.println(" Invalid Entry or no due amount left");
}

}
catch(Exception e)
{
System.out.println(e.getMessage());
}
finally
{
try

{
if(c!=null) c.close();
}
catch(SQLException igno)
{
}
}

}
}

MLockStat.java:

import java.sql.*;
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;

66
public class MLockStat extends HttpServlet
{
String lac,lcid,i;
Connection c;
Statement s;
ResultSet rs,rs1;
PrintWriter out;

public void doGet(HttpServletRequest req,HttpServletResponse res) throws


ServletException, IOException
{
doPost(req,res);
}

public void doPost(HttpServletRequest req,HttpServletResponse res) throws


ServletException, IOException
{
res.setContentType("text/html");
out = res.getWriter();
ServletContext context=getServletContext();

lcid=req.getParameter("lockid");
try
{
DriverManager.registerDriver(new
sun.jdbc.odbc.JdbcOdbcDriver());
c=DriverManager.getConnection(Bank.getDsn());
s=c.createStatement();
rs=s.executeQuery("select * from Locker where
Lock_id='"+lcid+"'");

if (rs.next())
{
int r=rs.getInt("Ramt");
if (r==0)
out.println(" Your Rent for this year is Paid...");
else
out.println(" Your Rent Amount "+r+" is to be
paid");
}
else
{
out.println(" Invalid Entry..Please check your Locker
Number.. ");
}

67
}
catch(Exception e)
{
System.out.println(e.getMessage());
}
}
}

Screenshots:

68
69
70
71
72
73
74
75
Bibliography

Books:

• James Keough.J2ME The Complete Reference: McGraw Hill, 2003


• David Flanagan.Java in Nut Shell:O’Reilly Publications,2000
• Thomson.J2ME in Nut Shell:O’ReillyPublications,2002
• Naughton.Java Hand Book:McGraw Hill,1998

References:

• www.java.sun.com
• www.developer.sun.com
• www.activeexperts.com
• www.j2me.org

76