CSE3330 Project #3

Application Coding
Thursday December 8, before midnight
Worth 13% of the final grade

You may do this project either on Omega (using Java or C) or on your PC/laptop (using Java on Windows, Mac OS X, or Linux).
Coding your Project on Omega

You may code your application program on Omega using either Java or C:

Coding in Java
Read the slides jdbc.ppt first, which explain JDBC. Download the jar file mysql-connector-java.jar on your omega account (at your top directory). Make sure that when you execute java -version you get "1.6.0_20". Then execute the following command every time you login into your omega account:
export set CLASSPATH=.:~/mysql-connector-java.jar:$CLASSPATH
(you may put this line at the end of your .login file so that you don't have to execute it every time). Then download mysql.java and change it to work on your database (change: user, password, db, and the query). You can compile it using javac mysql.java and you can run it using java SQL. Make sure that it works before you start coding your program.

Coding in C
You should first read MySQL C API. Then download mysql.c and change it to work on your database (change: user, password, db, and the query).
gcc -I/usr/include/mysql -L/usr/lib64/mysql -lmysqlclient -lz mysql.c
Then, to execute it, you do ./a.out.

Coding your Project on your PC/laptop

You can do this project on your PC/laptop using Java. The following instructions are for Microsoft Windows, but you can do this project on Mac OS or Linux too. For Microsoft Windows, you need to do the following:

On Windows, open a Command Prompt window and type:
ssh2 -L 3306:localhost:3306 xyz9999@omega.uta.edu
(replace xyz9999 with your own net-ID). Give your net-ID password and keep the window open and connected to omega. If you get the message "Warning: Local TCP/IP forwarding for port 3306 port failed." you need to disable your PC firewall (eg, if you use Symantec, set Network Threat Protection to off).

You compile the mysql.java using javac mysql.java. Every time you want to execute your java program, you need to do the following:

java -classpath "C:\Documents and Settings\Owner\Desktop\mysql-connector-java.jar";"." SQL
or wherever you stored the mysql-connector-java.jar file. If you get a Java error: "Exception in thread 'main' com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure", it means that your ssh2 connection has failed: login again using ssh2.

For Linux or Mac users: you can do the project on your computer, but you need to use ssh instead of ssh2 and : instead of ; in the classpath.

Application Requirements

Best Travel is interested in an application program interface that is easy to use so that it does not have to spend unnecessarily to train their employees. So, you are expected to write a program that consists of the following two applications for their daily transactions. Note that these application programs should use an ASCII interface (ie. by reading input text from the terminal and printing out text to the terminal). That is, it may provide choices by number and ask the user to choose a number). For example, it may say: "type 1 to start the flight inquiry or type 2 for reservations", and then may ask more information based on the application, such as, for the flight inquiry application, it may ask for source and destination cities, etc.

Flight Inquiry
This application is used to retrieve flight information between two given cities. The program, invoked by a choice on the main menu, should first issue prompts to obtain the start city and destination city of the trip. Additional input may include the departure date, departure time, arrival time, carrier, and flyer class. Then the inquiry application displays the flight information resulted from retrieving the database. For simplicity, we assume that when no departure date is given at the beginning, that day's date will be assumed. If no flyer class is given, the inquiry application should display the fare of all available classes on that flight.

This application is used to make the reservation, by which a travel agent should be able to insert the following data items into the database: reservation number, customer title, name, telephone number, address, frequent flyer memberships, payment mode, a list of flight instances and status of each. You design the interface for insertion of this data into the database. The database should be updated accordingly after each reservation, including the number of available seats.

You must handin your code as follows. All your source code must be in one file (eg, code.java or code.c). Don't submit any other file except your source code file. New Instructions: You should also submit the output of your execution for a sample session that searches for flights using some input parameters (two flight inquiry examples) and a sample session that uses the output of one of your searches to reserve a flight (one reservation). To keep your password secret, you may edit your source file and your output before you submit them to remove the password. The GTA will not run your program. You must use the following form to submit your files electronically. You may submit them as many times as you like, but only the most recently submitted files will be retained and evaluated.

Submit Project #3:

Last modified: 12/06/11 by Leonidas Fegaras