Site hosted by Angelfire.com: Build your free website today!
Web and Systems Based Programming Assignment 1

Java Based GUI - Internetworking

Content:

Back to top

File Hierarchy And Download
Application Client Side Server Side
Source Code
  1. ClientCP.java
  2. ClientCustomized.java
  3. CCProperty.java
  4. LuhnCheck.java
  1. ServerCP.java
  2. CCProperty.java
Documentation
  1. ClientCP.html
  2. ClientCP.WindowHandler
  3. ClientCustomized.html
  4. CCProperty.html
  5. LuhnCheck.html
  1. ServerCP.html
  2. CCProperty.html
Supplementary Files
  1. cc.properties
  2. amex.gif
  3. master.gif
  4. visa.gif
  5. visadebit.gif
  6. masterdebit.gif
  1. cc.properties
Download
Package Client Side Server Side
Source Code
Ducumentation
Binary Package
Full Package

Back to top

Requirements and Pre Installation :

First of all, this program requires JDK1.4 and above or JRE1.4 in order to execute the program. Please refer to Sun Java website (http://www.java.sun.com) to download the lastest JDK or JRE. Beware, any JDK or JRE which the version below 1.4 will not execute the program properly and maybe get error while compile or executing the class file.
After that, there will be 3 kinds of package downloaded : 1) Full Package , 2) Client Package and 3) Server Package (zipped file). Please download full package of assignment instead of single client side application or server side application only . Therefore, the program will be executed smoothly without any problem. The seperated package will have their own usage.

Back to top

Program Installation and Execution :

After downloaded the package, just unzip the package to folder . There will be binary files inside the package , if you want to compile again then just open the command prompt windows and open directory till the specific folder. There will be 2 folders which are Client and Server .

For client side application, compile the code using "javac ClientCP.java" at command prompt . Client side application successfully created if no compilation error occured.

For server side application, compile the code using "javac ServerCP.java" at command prompt . Server side application successfully created if no compilation error occured.

Next thing that need to be focused is that cc.property file that enable client side application retrieve the IP and Port Number in order to communicate with server as well as connection can be established. Make sure the cc.property file must be inside both client and server folder, else the application will not started.

For running at localhost : (both client and server running at same pc)
The setting for cc.property file is below :
IP=127.0.0.1
PORT=8088

For running at server : (both client and server running at different pc)
The setting for cc.property file is below :
IP=10.207.130.32
PORT=8088

** The IP must based on that server's IP address else the client application will not cummunicate with server.

For example,
- Client Side Application at C://client
- Server Side Application at C://server
To start up the server, open the command prompt windows and type
cd server
java ServerCP

** NOTE: 'cc.properties' must with ServerCP.class
** The Server successfully started if no error message that address the error start server.

To run client application, open the command prompt windows and type
cd client
java ClientCP

** NOTE: 'cc.properties' must with ClientCP.class
** A GUI of Credit card Transaction will appear at screen that indicate the client application is running now.

Back to top

System Overview :

GUI

The Credit Card Transaction Interface

Assume from the program installation and execution part, the server(ServerCP) and client(ClientCP) application already running. Therefore, we just discuss about the flow of the system.
The System Flow :

Back to top

Validation Algorithm :

All the fields that appeared at client application must be filled. The basic textfield validation algorithm is below : First of all, client application will check the blank field of that particular textfield. Once blank field detected, users will be prompted to enter that particular field. After that, the input of that particular textfield will be validated (Discuss the details below). Again, users will be prompted to input and error will be highlighted when error detected.
** Note : Check blank field validation and input validation for each textfield before the following textfield.

1) Date validation :
For both the date that needed to input (Date Valid To and Date Valid From), the format is fitted to MM-YYYY. On the other ,MM-YY/MM-YYY format also accepted, system will parse that date to december of year 999 when 12-999 inserted. Any other data type not from numeric will be thrown exeption and error message will pop up. Besides, comparison between both date and current date also had been done to avoid any expiration card also use the credit card transaction and vice versa .

2) Number validation :
For amount and security code textfield, validation will be made for digit checking only. Any data inserted that contain any non-digit data will be thrown exeption and error message will pop up.

3) Luhn Check Algorithm :
Luhn Check Algorithm is used to check/validate the card number. This algorithm written in Java and obtained from http://www.merriampark.com/anatomycc.htm using mod 10 calculations. The algorithm used to arrive at the proper check digit
All card can be checked using this Algorithm.
The Issuer Identifier is the main idea of the appearance of Luhn Check Algorithm. For example, Issuer Identifier Card Number Length table

Issuer Identifier Card Number Length
American Express 33xxxx, 37xxxx 15
VISA 4xxxxx 13, 16
MasterCard 51xxxx-55xxxx 16

Luhn Check Algorithm used those Issuer Identifier to validate the card number .
Below taken from the website :

Thanks to Aleksandar Janicijevic for directing me to information about H.P. Luhn.

The most succint description of the Luhn algorithm I have found comes from the hacker publication phrack 47-8: "For a card with an even number of digits, double every odd numbered digit and subtract 9 if the product is greater than 9. Add up all the even digits as well as the doubled-odd digits, and the result must be a multiple of 10 or it's not a valid card. If the card has an odd number of digits, perform the same addition doubling the even numbered digits instead."


The idea is certain cards have certain card number format like Visa card number first digit starts with a 4, Mastercard first digit starts with a 5 and American Express card number starts with 3 at the first digit. Validation is done to the card number format as well as the length of the card number as different card varies in different card number length.

Back to top

Critcal Appraisal

Overall, all the sections mentioned had been done. Section 1 which involves GUI that conttribute most of the problem that faced along the assignment. The main point is which layouts used to design the client side application interface ? Finally, pure GridBagLayout layout from Java.AWT had been chosen and constraints of GridBag had been declared to design a pure GridBagLayout based interface instead of using JPanel. Although using JPanel is good but pure GridBagLayout layout give an extra control of designing interface and become a good practice to explore GridBagLayout layout.

Beside, some components, object and methods from Java Swing had been used. First of all, Input Mask that used at Date To and Date From field is taken from Java Swing (JDK1.4 only) which fit the Mask into MM-YYYY format. Numerous methods had been used to validate data includes format the input that fit the current Decimal Formatter as did for Amount and Security Code field to avoid unwanted data. Besides, highlighter had been used for highlighting the errors that detected which error message . Key Adapter and Key Event had been used for limiting some characters that can be inserted only.

Section 2 and 3 for this assignment just simply involves socket programming in Java. This is just a simple method for client and server technology at Java language . Therefore, the source code for socket programming easier to get any references from book or internet source. However, there are others technologies like RMI which is much stable and safer. Socket is facing risk of losing data while communicating or bad packets. For the current trend at Java World, RMI already used to replace socket in client and server technology and the technology now slowly migrated to another technology called JiniTM technology which believed to be more stable and realiable.

Although this assignment just ignore the security issues of online credit card transaction, but security issues also a hard issues to settle especially policy permission that faced by java application or applet when running live at internet. Therefore , this not a important issues for this critcal appraisal. However, this is a global issue that online credit card transaction will exposed the credit card number if the digital security certificates not standardized for credit card.

Back to top

References :