Page 1 of 3IT-230 Final Project Part 1 – GUI Proposal (100 Points – 15% of Your Grade)
Due Date: Tuesday, March 3rd, 2022 before 11:59 PM
Tasks: Research, design and build a complete Java Graphical Interface for a simple Java Application of your choice
for collecting and processing its data.
Requirements: You must develop your GUI by writing your own Java code using Dr. Java without using other
automated development tools.
1.
2.
3.
4.
Your GUI must include the following components:
a. JLabel
b. JTextField
c. JCombobox
d. JRadioButton
e. JCheckBox
f. JTextArea
g. ImageIcon
h. JButton
i. JPanel
j. JFrame
The total number of all components (a-g) combined must be 30 components or more.
Restrictions
a. JPanel, JFrame, and ButtonGroup are NOT qualified as one of the 30 components.
b. At least 20 components must allow user inputs (b-f). For example, JLabel does NOT allow users
to input anything; therefore, it cannot collect data and is NOT qualified as one of the 20
components.
Your GUI must be user-friendly.
Implement Action Listener to collect information and display it using JOptionPane for confirmation of the
process.
Sample 1: You are NOT allowed to build this sample GUI as your proposal.
Sample proposal for a Java Graphical User Interface (GUI) for a simple Car Reservation System
Page 2 of 3
JComboBox data:
1. Pick-up and Drop-off time is between 7 am – 7 pm when it is dropped.
2. Car type displays the choices of Economy, Compact, Mid-Size, Standard, Full-Size, Premium, Luxury, Convertible,
Minivan, and SUV when it is dropped.
Sample 2: You are NOT allowed to create this sample GUI as your proposal.
Sample proposal for a Java Graphical User Interface (GUI) for a simple Hotel Reservation System
Page 3 of 3
JComboBox data:
1.
No. of rooms should display the choices of 1, 2, 3, 4-9, 10-25 and 26+ when it is dropped.
2.
Guests/Room should display the choices of 1-6 when it is dropped.
IT-230 Final Project (Part 2)
(100 Points: 15% of Your Final Grade)
Due Date: Wednesday, May 4th by 11:59 PM
(No Late Submission)
Tasks: Use the Java Application that you built for the midterm exam to collect and process data.
You can download the Java file you submitted for the Midterm Exam in Canvas or use a new version that
you have developed.
1. Create MySQL database and table to store the data from the components you collect from your
GUI. (Submit all SQL commands in a .txt file or paste it in the comment box when you submit
your work.).
Note: You do not need to save data from all components into your database, and the minimum
requirement is five (5) columns to save data from your selected five (5) GUI components.
2. Modify the Event Handler to collect data from the components and save it in your database table.
3. Create your own Java exception and use it for one of your GUI components to detect and handle
an error.
4. Implement a File I/O process of your choice in your GUI to either write data to a text file or read
data from a text file.
5. Implement a Server/Client process of your choice that connects your GUI (Client) to another Java
class (Server). This part can be either one-way or two-way communication.
Submission on Canvas:
· Java file(s) for your GUI
· Java exception file that you build
· Text file (.txt) for your database commands
· All images you use for the GUI
Valid File Type: java, txt, doc, docx, png, jpg, and jpeg
Example of using Hotel Reservation Application I provided in the final project part 1 to
demonstrate the processes of this second part.
Description
Your project does not need to be intensive as this example, and you can only focus on the requirements of
the final project. The purpose of this example is to give you an idea of the processes.
Database Part
1. An example the database and table.
2. The “Submit” saves reservation information into the database.
2.1. Entering information
2.2. After information is saved successfully, the program displays the following message.
2.3. Information is now saved in the database. Run the “select” command to check whether the
information is saved or not.
Server/Client Part (The example uses two-way communication)
Note: You can implement either one-way or two-way communication for your final project.
1. The purpose of this table is to store valid credit card information. Manually insert a credit card record
into the credit card table
The credit card table only contains one field and its data format is that the first 16 numbers is credit
card numbers and remaining 5 (XX/XX) is expiration date.
2. CreditCardServer.java will be used to verify the validation of credit card information sent by your
Hotel Reservation System GUI.
3. The “Submit” button sends the credit card information (credit card numbers and expiration date) to
the credit card server you create above. If the message received from the credit card server is “Yes”,
then the GUI saves the reservation in the reservation table, otherwise, pop up a message to notify the
user that the credit card information is invalid.
Sample Run:
NOTE: This is a valid credit card in the credit card table which I manually insert it into the table.
3.1. Start “Credit Card Server”
3.2. Start “Hotel Reservation System”
3.2.1. When an invalid credit card is entered in the GUI and “Submit” button is clicked, it sends
the credit card information to the Credit Card Server.
Server receives the credit card information and search for it in the credit card table. In this
case, it’s not valid, so it returns a message “No” back to the GUI.
The GUI receives the message “No” and displays a pop up message without saving the
reservation.
Check in the database, this reservation MUST NOT be inserted.
3.2.2. When valid credit card information is entered in the GUI.
Server validates that it is a valid one, so return a message “Yes” to the GUI.
The GUI receives the message “Yes”, displays a pop up message and saves the reservation
in the database.
When I check in my database, I see the record saved.
Exception and File I/O Part
1. Create an exception class “InvalidCreditCardException.java” to be used with the Hotel Reservation
System. Default error message is “”Error: Wrong credit card number!!! Only enter 16 numbers on
your card without spaces!!!”
2. The “Submit” button checks and handles the following exceptions if an invalid credit card number.
Example of valid data entered.
There is no dash in the credit card number and it is 16 digits beginning with number 4 because it is
VISA.
Here are the exceptions.
2.1. When the credit card number is VISA, MASTER or DISCOVER and does not contain 16
numbers, displays the default error message from the InvalidCreditCardException you
create above.
2.2. When the credit card is American Express and its number is not 15 digits, displays
“Invalid Amex card number!!! Only enter 15 numbers on your card without spaces.”.
2.3. When the credit card is American Express and the first number is not 3, display “Invalid
Amex card number!!! Must begin with 3.”.
2.4. When the credit card is Visa and the first number is not 4, display “Invalid Visa card
number!!! Must begin with 4.”
2.5. When the credit card is Master Card and the first number is not 5, display “Invalid Master
card number!!! Must begin with 5.”
2.6. When the credit card is Discover Card and the first number is not 6, display “Invalid
Discover card number!!! Must begin with 6.”
3. After the credit card number is validated as a valid card, it then writes the reservation information to a
text file. Credit card number is used as a file name. Below is an example.
a. Enter information
b. When the credit card is valid, the program writes the information to a text file. And after
information is written to the file successfully, the program displays the following
message in a JOptionPane to notify the user.
c. Data is now written to the text file and credit card number is used as the file name.
import java.awt.BorderLayout;
import java.awt.GridLayout;
import java.awt.event. ActionEvent;
import java.awt.event. ActionListener;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileWriter;
import java.io.IOException;
import java.util.Scanner;
import javax.swing. ButtonGroup;
import javax.swing.ImageIcon;
import javax.swing. JButton;
import javax.swing.JComboBox;
import javax.swing.JFrame;
import javax.swing. JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing. JRadioButton;
public class TollFee5 extends JFrame implements ActionListener {
String types []={“Regular Tolls”, “Peek Weekends”};
private JRadioButton combo1, combo2, combo3;
private JComboBox typeCombo;
private JLabel typeLabel, wheel2Label, whee122Label, whee123 Label, vehicle Type Label ;
private JPanel nPanel, cPanel, cPanel2, sPanel;
private ImageIcon wheel2Icon, wheel3Icon, wheel2BikeIcon;
private JButton pay, print, clear;
private ButtonGroup bg;
public TollFee5() {
setTitle(“Toll Fee Cashier System”);
nPanel = new JPanel();
typeLabel = new JLabel(“Type of Fee: “);setTitle(“Toll Fee Cashier System”);
nPanel = new JPanel();
typeLabel = new JLabel(“Type of Fee: “);
typeCombo = new JComboBox(types);
nPanel .add(typeLabel);
nPanel .add(typeCombo) ;
add(nPanel, Border Layout. NORTH);
cPanel new JPanel();
cPanel .setLayout(new GridLayout(1,2));
vehicleTypeLabel = new JLabel(“Type of Vehicle : “);
combo1 = new JRadioButton(“”);
whee12Icon = new ImageIcon(“car.gif”);
whee12Label = new JLabel(wheel2Icon);
combo2 = new JRadioButton(“”);
whee13Icon = new ImageIcon(“truck.gif”);
whee122Label = new JLabel(wheel3Icon);
combo3 = new JRadioButton(“”);
whee12BikeIcon = new ImageIcon(“motorcycle.gif”);
whee123Label = new JLabel(wheel2BikeIcon);
bg=new ButtonGroup();
bg.add(combo1); bg.add(combo2); bg.add(combo3);
cPanel.add(vehicleTypeLabel);
cPanel.add(combo1);
cPanel.add(wheel2Label);
cPanel.add(combo2);
cPanel.add(whee122Label);
cPanel.add(combo3);
cPanel .add(whee123 Label);
cPane12 = new JPanel();
cPane12.add(cPanel);
add (cPane12, BorderLayout .CENTER);
pay = new JButton(“Pay”);public vold actionPerformed (ActionEvent e)
if (e.getSource() ==pay){
String feeType
String typeV=””;
String fee=””;
if (combo1.isSelected()) {
}
else
=
typeCombo.getSelected Item().toString();
}
else{
typeV=”2 Axels”;
fee=”3.00″;
if (combo2. isSelected()) {
typeV=”3 or more Axels”;
fee=”4.00″;
}
else if (combo3.isSelected()) {
typeV=”MotorCycle”;
fee=”1.00″;
try {
} catch (VehicleException el) {
}
throw new VehicleException();
JOptionPane.showMessageDialog(null, el.getMessage());
}
if (combo1.isSelected() || combo2. isSelected () || combo3.isSelected()) {
try {
FileWriter fw= new FileWriter(“receipt.txt”);
fw.write(“Vehicle Type: “+ typeV);
fw.write(System.line Separator());
fw.write(“Fee Type : “+feeType);
fw.write(System.lineSeparator());
fw.write(“Fee: $”+fee);
fw.close();
} catch (IOException e) {