You are on page 1of 67

Cavite State University – Imus Campus

LTO Compound, Palico IV, Imus City, Cavite


Department of Information Technology

Thesis Paper

COFFEE 19
A COFFEE SHOP
ORDERING SYSTEM
In partial fulfillment of the requirements for the subject DCIT 55C

(Advanced Database Management System – Laboratory)

Submitted By:

Carlos David Q. Miciano

2019101628

BSIT 2-D

Submitted To:

Sir. Armando Tampos


Instructor

May 2021

1
ACKNOWLEDGEMENT

This system would not done with out the help of the programmer’s fellow classmate’s

Samantha Torres and Allen Glenn Castillo for the information, methods, and techniques they

shared that help mo for the progress of this system. Together with the random indian people

youtuber where the programmer searched and watched thier tuitorials for the methods and

technique’s where the programmer find it hard to apply and implement to the system. The

programmer also would like to Thanks Sir Armando Tampos for making this as an individual

project, where the programmer take this as an opportunity to learn more in programming and in

database management system, and to gain also the programmer’s experience in those fields, and

also to learn to be an independent professional programmer in the future.

2
ABSTRACT

This System Documentation contain’s the programmer’s aims, together with how will the

Data Flow, it’s ERD, the Flow Chart of the system. And also the programmer’s system results

where it will implement the said DFD, ERD, and Flow Charts and also the programmer will discuss

it briefly so that the reader may understand the given figure. The programmer will also discuss

briefly the functions in the system, the code’s and how it will work and so on in theresult part of this

decumentation.

3
TABLE OF CONTENTS

Acknowledgement ....................................................................................................2

Abstract .....................................................................................................................3

Introduction ...............................................................................................................5

Entity Relationship Diagram ....................................................................................5

Data Dictionary ..........................................................................................................6

Data Flow Diagram ....................................................................................................9

Flow Chart ...............................................................................................................12

Results .....................................................................................................................27

User Side GUI ..........................................................................................................27

Admin Side GUI .......................................................................................................54

Conclusion ..............................................................................................................67

4
INTRODUCTION

Have you been to a coffeee shop and order a one cup of coffee? Well everyone of us know

how to order not just in a coffeeshop but in also in different fast food shop where you will enter and

stand for so long in a line of a queue people placing and waiting there order. So that’s why many

professional and amateur programmer’s work in different companies in the world decided to

created different odering system and website in order to make the ordering process quickly and

convenient. The’re so many existing different ordering website and system in our world we’re what

you need to do to have the app or visit the webisite, click it, enter your account, browse the item

you want to order, place order it, confirm the order, pay it, and wait it to deliver to you or you can

come to shop and pick up. In this documentation the programmer will discuss the innovated coffee

shop ordering system from its diagram and to its results.

ENTITY RELATIONSHIP DIAGRAM

In this part of the System Documentation, the programmer would like to show and discuss

the ERD of the System’s database.

Figure 1.1 Coffee 19 Coffee Shop Ordering System ERD

5
A. PRODUCT and CATEGORY

In the relationship between product and category they the One to Many Relationship, where

every product belong to its own specific category such as Hot Coffee, Cold Coffee, and Frapuccino.

For example a customer a order a product Iced Cold Capuccino and customer b order Iced Cold

Americano, so the Category of both product will be Cold Coffee. Where we can say that One

Category has a many Product belong to it.

B. PURCHASE_DETAIL and PRODUCT

Every product that has been ordered will be recoded to purchase detail table, where for

example customer a and customer b order a different product, both order will be recorded in a

purchase detail table.

C. CUSTOMER AND PURCHASE DETAILS

The customer table contain the personal information of the registered customer in the

system, such as his/her fullname, username, and password. Where once he/she ordered, his/her

name will be recorded into the purchase detail table together with his/her product ordered.

D. ADMIN

The Admin in the figure stand alone because this table used to store the admin account that

will be used to acces the admin panel for monitoring the purchase_details.

6
DATA DICTIONARY

The table below show’s every entities and its attributes including it’s datatype and so on.

PRODUCT
Field Name Data Type Data Format Field Size Description Example
Unique
ID Varchar NNNN 10 Identifier for all P101
products
Foreign Key
for the Unique
number ID for
C_ID Varchar NNNN 10 category in C101
CATEGORY
TABLE

Name for Item Hot brew


ITEM Varchar NNNN 50
of product coffee
Price of
PRICE Int NNNN 10 46
Product

Table 1.1 Product Table Data Dictionary

CATEGORY
Field Name Data Type Data Format Field Size Description Example
Unique
number ID for
category in
C_ID Varchar NNNN 10 C101
CATEGORY
TABLE

Name for
CAT_NAME Varchar NNNN 50 products Hot Coffee
category

Table 1.1 Category Table Data Dictionary

7
PURCHASE_DETAILS
Field Name Data Type Data Format Field Size Description Example
Unique
P_ID Varchar NNNN 10 Identifier for all 12
products
Foreign Key
for the Unique
number ID for
USERNAME Varchar NNNN 50 category in C101
CATEGORY
TABLE

Name for Item Hot brew


ITEM Varchar NNNN 50
of product coffee
Price of
QUANTITY Int NNNN 11 46
Product
Total price per
TOTAL Int NNNN 11 150
item

Date were the


DATE_OF_P MM/DD/YYYY 2021-03-15
Datetime item
URCHASE 12:14:09
purchased

Status of
STATUS varchar NNNN 10 PAID
transaction

Table 1.1 Purchase Detail Table Data Dictionary

CUSTOMER
Field Name Data Type Data Format Field Size Description Example
Unique
Identifier for
CS_ID Int NNNN 11 1
the records in
customer table
Name of the Carlos David
FULLNAME Varchar NNNN 100
Customer Miciano
Another
unique
USERNAME Varchar NNNN 50 identifier for CarlosPatricia
the records in
customer table
Password of Cookiesand
PASSWORD Varchar NNNN 50
customer user cream

Table 1.1 Customer Table Data Dictionary

8
ADMIN
Field Name Data Type Data Format Field Size Description Example
Unique
A_ID Int NNNN 11 Identifier for 1
the records
Username
Varchar ADMINCARLO
USERNAME NNNN 50 column for
S
admin
Password
PASSWORD Varchar NNNN 50 Column for ADMIN1234
admin

Table 1.1 Admin Table Data Dictionary

DATA FLOW DIAGRAM

The following diagram shows how will the data flow and stored and use as it needed.

9
Figure 2.1 Coffee 19 Cofee Shop Ordering System Data Flow Diagram

In the figure above we saw that most of the data will com from the customer. In the first step

it show that once the customer log in, the data such as username and password inputed by the

customer will be verified first if it’s existing in the database. If the customer would like to sign up for

an account, it will as first for his Fullname, username, and password, and once the user or the

customer fill up all the fields, the data inputed by the customer will be recorder in the database. If

the customer would like to retirev his account, it will be ask for for his username and new

password, the data(username and password) inputed by the customer will be check first if it is

existing in the database and once it confirmed that the username exist the password now will be

updated inside the database.

10
Another one is if the customer orders, for example iced cold coffee, the record iced cold

capuccino inside the database and its price also the category ID where the product belong will be

used to insert it on the another database table which is the purchase detail table inside the

coffeeshop database.

11
FLOW CHART
The Following Flow Chart will show the alghorithm of the entire system.

Figure 3.1 Coffee 19 Coffee Shop Ordering System Flow Chart

12
Figure 3.2 Coffee 19 Coffee Shop Ordering System Flow Chart

13
Figure 3.3 Coffee 19 Coffee Shop Ordering System Flow Chart

14
Figure 3.4 Coffee 19 Coffee Shop Ordering System Flow Chart

15
Figure 3.5 Coffee 19 Coffee Shop Ordering System Flow Chart

16
Figure 3.6 Coffee 19 Coffee Shop Ordering System Flow Chart

17
Figure 3.7 Coffee 19 Coffee Shop Ordering System Flow Chart

18
Figure 3.8 Coffee 19 Coffee Shop Ordering System Flow Chart

19
Figure 3.9 Coffee 19 Coffee Shop Ordering System Flow Chart

20
Figure 3.10 Coffee 19 Coffee Shop Ordering System Flow Chart

21
Figure 3.11 Coffee 19 Coffee Shop Ordering System Flow Chart

22
Figure 3.12 Coffee 19 Coffee Shop Ordering System Flow Chart

23
In the Figure’s shown above, the figures show’s how the system will flow and process. In

Figure 3.1 it shown there that once the system run, it should display a windows with two button on

it the user and admin. Let us discuss first how the system flow when it pressed the user that will be

shown from figures 3.1 to 3.7 and later on the programmer will discuss also the flow in admin

shown in figure 3.8 to 3.12.

In figure 3.1 as the user button click, the system should display a window that will ask for

customer username and password, and also it has a button where a customer or the user can

retrieve his/her account if he/she forgot’s his/her password, and also a button for creating an

account for new user. Now once the user enter it’s username and password, the program should

log in the customer if it’s the username and password is exixsting in the database, if it’s not the it

wont log in. So the customer mayber forgot his/her password or he/she doesnt have an account yet

so thats’s why there is a button where a system can retrieved the customer password or can create

a new one once it clicked, that the programmer will discuss later in figures 3.6 and 3.7.

As the customer succesfully logged in, in figure 3.2 the system should display a windows

where there are button for Hot Coffee, Cold Coffee, and Frapuccino, also a button that a customer

can check the list of his/her placed order(s) and a log out button. Once the customer clicked wheter

in hot coffee, cold coffee, or frapuccino in figures 3.3 to 3.5 the system should display a window

with a button buttons containing the different products. Onced a user pressed a button containing

the product, the system should display the name of the product and the price and it will also ask for

the user to put the quantity of the product, and once the user enter the quantity of the product then

as the customer hit the enter button, it should display the total price and also when the cutomer

click the placed order, the system should record the order in the database as “not paid” as what

shown in figure 3.3. Now as the customer click the back button, it the system should return the user

to the user menu page where the user can check his/her order by clicking the Check Order Button.

Now as the user click the Check Order Button, In figure 3.5 the system should now display a

window where there’s a table showed the customer orders, a delete button where a user can delete

his/her order by entering the P_ID from the table showed. There should also a get total button

where once the user click it, it should display the total price of all the products he/she order(s). It

should also ask for the payment by simply entering the payment in the text box and by clicking the

24
confirm order, the system should record all the products showed in table as “Paid” in the database,

and it should display the change of customer if he/she entered a money that is greater than the

total ammount. Now if the user is not satisfied in the order he/she makes and would like to add

order, there should have a “add order” order button so that the customer can add more product he/

she want to order(s). and if the customer would like to cancel all the order he/she made, there

should be a “cancel order” button in it where it could truncate the order(s) that the customer placed

and thesystem should bring the user back to the user menu window. If the user wants to log out,

the user menu window should have a “log out” button that once the user click it, the system should

log out the user and bring him/her back to login window.

In figures 3.6 and 3.7 the programmer now will discuss how will be the flow if the user click

the forgot password button or the sign up button. In fugure 3.6 as the user click the sign up button

in log in window, the system should display a window that should ask for the user fullname,

username, password, and to confirm the password. There should be a button that will confirm the

registration of the user for his/her new account. The system should also check if the password and

confirm password matched, If its not then the user should re-type the password or the confirm

password to securely matched the two. In retrieving the password as the figure 3.7 showed,

thsystem should display a window that should ask for the user’s username and password. Once

the “enter” button clicked the system should check first if there is a username that is existing in the

database and if there is, therefore the password will be updated but if not, it wont update.

Now let’s talk about the flow of the system once the user click the admin button in fugure

3.1. As the user click the admin button in start up page, the system should display a log in form

window for admin base on figure 3.8 and it should ask for the admin username and password.

Same as in user login in window once the admin user enter it’s username and password, the

program should log in the customer if it’s the username and password is exixsting in the database,

if it’s not the it won’t log in. In figure 3.9 as the admin is logged in, it should display a window with a

“show a record” button and “Search a record button” in it, and also by default it should have a “log

out” button. If the user click the show a record button, in figure 3.9 the system should display a

window where it has these buttons: Admin Table, Purchase Detail Table, Product Table, Customer

Table, Category Table where if one of those table clicked, therefore it should display a table from

the database base on the name of the button. If the admin want’s to delete a record based on

25
figure 3.10 a “delete a record” button should have so that once the admin click it, the system

should display a window where there is a combo box that the admin could choose whether he/she

like to delete a data from Purchase detail or Customer Account. There should also a two table

displaying the data from purchase detail and customer account so that is is easy for admin to

delete a data by simply entering the id of the record he/she wanted to delete and it will be deleted

as the admin clicked the delete button. And if the admin wants to delete the entire record, he/she

can jus clicked the delete all button that the window should have. As the admin return to the admin

panel window by clicking the back button that shoyuld be exixsting in the windows mentioned

above, if he wanted to search a record by clicking the “search a record button” the system should

display a window were the admin cans earch a record base on figure 3.10. And also the window or

the page should have a 3 table displaying the Purchase Detail, Customer Account, and Category.

The system should display the searched data in the table as the admin input a data.

26
RESULTS

USER SIDE

In this part of the Documentation, the programmer would like to show the final result of the

system and how it works through the screenshots of GUI that will be showed later. The

programmer will also show the java code, and also how the programmer implemented the DFD,

ERD, and Flow Charts showed and discussed in the introduction of this documentation.

Figure 4.1 Coffee 19 Coffeeshop Ordering System GUI

27
Figure 4.2 Coffee 19 Coffeeshop Ordering System GUI

In the figure’s above as the system runs, it start with a window with two button, one for

admin and the another one for user. If we click the user it will display a window that has been

shown in figure 4.2.

User Button Java Codes

private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {


USER U = new USER();
U.show();

dispose();
}

28
In figure 4.2 if the user does’nt have a account he/she can create one by clicking the register

button. In the customer sign up window where the user can create a account as what shown in

figure 4.3

Figure 4.3 Coffee 19 Coffeeshop Ordering System GUI

If the user entered a username where if the username was already taken by the another

user registered, it will display a message where it said “Username already taken” base on figure

4.4. And in figure 4.5 if the customer mismatched the password he entered and in the confirm

password field it will display an error “Password Does Not Matched”.

29
Figure 4.4 Coffee 19 Coffeeshop Ordering System GUI

Figure 4.5 Coffee 19 Coffeeshop Ordering System GUI

30
Register Button Java Codes

private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {


SIGN_UP SU = new SIGN_UP();
SU.show();

dispose();
}

Sign up Button Java Codes

private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {

if (FULLNAME.getText().length()!=0) {
try{
ps = con.prepareStatement("INSERT INTO CUSTOMER(FULLNAME, USERNAME,
PASSWORD) VALUES (?,?,?)");
ps.setString(1, FULLNAME.getText());
ps.setString(2, USERNAME.getText());
ps.setString(3, CPASSWORD.getText());
if(PASSWORD.getText().equals(CPASSWORD.getText())){
ps.executeUpdate();
JOptionPane.showMessageDialog(null, "Account Registered!");

}
else if(PASSWORD.getText().length()==0 || FULLNAME.getText().length()==0 ||
CPASSWORD.getText().length()==0 || USERNAME.getText().length()==0 ){
JOptionPane.showMessageDialog(null, "Please Fill Up All Fields");
}
else{
JOptionPane.showMessageDialog(null, "Password Does Not Matched!");
}

}
catch(SQLException e){
JOptionPane.showMessageDialog(null, "Username Already Taken!");;

}
else{
JOptionPane.showMessageDialog(null, "Invalid Input");

Back Button Java Codes

private void jButton7ActionPerformed(java.awt.event.ActionEvent evt) {

USER U = new USER();


U.show();

dispose();
}

31
What would happen if the user suddenly forgot his/her password? Then the user can

retrieved it by clicking the forgot password. The user should enter his/her username and the new

password. If the username is does not matched any username in the database therefore it wont

update the password. But if the username is existing in the database therefore the password will

automatically updated. See the figures 4.6 and 4.7.

Figure 4.6 Coffee 19 Coffeeshop Ordering System GUI

32
Figure 4.7 Coffee 19 Coffeeshop Ordering System GUI

Forgot Password Button Java Codes

private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {


F_PASS FP = new F_PASS();
FP.show();

dispose();
}

Enter Button Java Codes

private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {


if(USERNAME.getText().length()!=0 && PASSWORD.getText().length()!=0){
try {
ps = con.prepareStatement("UPDATE CUSTOMER SET PASSWORD = ? WHERE
USERNAME = ?");
ps.setString(1, PASSWORD.getText());
ps.setString(2, USERNAME.getText());
int i = ps.executeUpdate();
if(i != 0){
showMessageDialog(null, "Password Succesfully Changed!");
}
else{
showMessageDialog(null, "No Username Existing!");
}

}
catch (SQLException e) {
showMessageDialog(null, "error database");
}
}
else{
showMessageDialog(null, "Incomplete Input");

33
}

}
Back Button Java Codes

private void jButton7ActionPerformed(java.awt.event.ActionEvent evt) {


// TODO add your handling code here:
USER U = new USER();
U.show();

dispose();
}

By default, in logging in the account if the user entered an incorrect username and password

usually what happen is they wont log in as what shown in figure 4.8. And in figure 4.9 if the user

succesfully log in then the customer menu will appear where the user can choose whether he/she

likes to order a Hot Cofee, Cold Coffee, or Frapuccino Coffee.

Figure 4.8 Coffee 19 Coffeeshop Ordering System GUI

Log In Button Java Codes

private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {


try {
ps = con.prepareStatement("SELECT USERNAME,PASSWORD from `costumer` where
USERNAME = ? AND PASSWORD = ?");
ps.setString(1, USERNAME.getText());
ps.setString(2, PASSWORD.getText());
ResultSet res = ps.executeQuery();

34
if (res.next()) {
customer C = new customer();
C.USERNAME.setText(USERNAME.getText());
C.show();

dispose();

}
else {
showMessageDialog(null, "incorrect Username or Password!");
}
}
catch (SQLException e) {
e.printStackTrace();
}

Figure 4.9 Coffee 19 Coffeeshop Ordering System GUI

Java Codes:

Cold Coffee Button

private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {


// TODO add your handling code here:
COLD_COFFEE CC = new COLD_COFFEE();
CC.USERNAME.setText(USERNAME.getText());
CC.show();

dispose();
}

Frapuccino Button

35
private void FRAPUCCINOActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
FRAPUCCINO F = new FRAPUCCINO();
F.USERNAME.setText(USERNAME.getText());
F.show();

dispose();
}

Hot Coffee Button

private void HOT_COFFEEActionPerformed(java.awt.event.ActionEvent evt) {


// TODO add your handling code here:
HOT_COFFEE HC = new HOT_COFFEE();
HC.USERNAME.setText(USERNAME.getText());
HC.show();

dispose();
}

From the figure 4.9 above, If the customer for example would like to order hot coffee, then

he/she can click the hot coffee button. And inside the hot coffee if the customer would like to place

and order base on the choices available, the he/she can simply click the button under hot coffee list

from what shown in figure 4.10 and then it will display the name and the price.

Figure 4.10 Coffee 19 Coffeeshop Ordering System GUI

Java Codes:

Brew Coffee Button

36
private void HBCActionPerformed(java.awt.event.ActionEvent evt) {
try {
ps = con.prepareStatement("SELECT ITEM, PRICE FROM PRODUCT WHERE ITEM =
'BREW COFFEE' AND PRICE = 48.00");
ResultSet res = ps.executeQuery();
if(res.next()){
ITEM.setText(res.getString(1));
COST.setText(res.getString(2));
}
}
catch (SQLException e) {
e.printStackTrace();
}
}

Brown Coffee Button

private void HBRCActionPerformed(java.awt.event.ActionEvent evt) {


try {
ps = con.prepareStatement("SELECT ITEM, PRICE FROM PRODUCT WHERE ITEM =
'BROWN COFFEE' AND PRICE = 55.00");
ResultSet res = ps.executeQuery();
if(res.next()){
ITEM.setText(res.getString(1));
COST.setText(res.getString(2));
}
}
catch (SQLException e) {
e.printStackTrace();
}
}

Americano Button

private void AActionPerformed(java.awt.event.ActionEvent evt) {


try {
ps = con.prepareStatement("SELECT ITEM, PRICE FROM PRODUCT WHERE ITEM =
'AMERICANO' AND PRICE = 55.00");
ResultSet res = ps.executeQuery();
if(res.next()){
ITEM.setText(res.getString(1));
COST.setText(res.getString(2));
}
}
catch (SQLException e) {
e.printStackTrace();
}
}

Capuccino Button

private void CAPUCCINOActionPerformed(java.awt.event.ActionEvent evt) {


try {
ps = con.prepareStatement("SELECT ITEM, PRICE FROM PRODUCT WHERE ITEM =
'CAPUCCINO' AND PRICE = 60.00");
ResultSet res = ps.executeQuery();
if(res.next()){
ITEM.setText(res.getString(1));
COST.setText(res.getString(2));
}
}
catch (SQLException e) {
e.printStackTrace();

37
}
}

Latte Button

private void LATTEActionPerformed(java.awt.event.ActionEvent evt) {


try {
ps = con.prepareStatement("SELECT ITEM, PRICE FROM PRODUCT WHERE ITEM =
'LATTE' AND PRICE = 60.00");
ResultSet res = ps.executeQuery();
if(res.next()){
ITEM.setText(res.getString(1));
COST.setText(res.getString(2));
}
}
catch (SQLException e) {
e.printStackTrace();
}
}

The user or the customer should enter the quantity of the product he/she want to order, as

the customer click the enter it will display the total price, and to place an order he/she should click

the place order button. See the figure 4.11

Figure 4.11 Coffee 19 Coffeeshop Ordering System GUI

Java Codes:

Enter Button

38
private void jButton7ActionPerformed(java.awt.event.ActionEvent evt) {
int quantity = Integer.parseInt(QUANTITY.getText());
if(quantity > 0 && quantity <= 100){
double Price = Double.parseDouble(COST.getText());
int price = (int) Price;
int Total = price * quantity;
double total = Total;
TOTAL.setText(Double.toString(total));
}
else{
JOptionPane.showMessageDialog(null, "Error Order Count!");
}
}

Place Order Button

private void jButton8ActionPerformed(java.awt.event.ActionEvent evt) {


try {
ps = con.prepareStatement("INSERT INTO PURCHASE_DETAIL(USERNAME, ITEM,
QUANTITY, TOTAL, STATUS) values(?,?,?,?, 'NOT_PAID')");
ps.setString(1, USERNAME.getText());
ps.setString(2, ITEM.getText());
ps.setString(3, QUANTITY.getText());
ps.setString(4, TOTAL.getText());
int i = ps.executeUpdate();
if (i != 0) {
JOptionPane.showMessageDialog(null, "Item Succesfully Purchased!");
HOT_COFFEE HC = new HOT_COFFEE();
HC.USERNAME.setText(USERNAME.getText());
HC.show();

dispose();
}
}
catch (SQLException e) {
e.printStackTrace();
}
}

For the following figures 4.12 and 4.13, if the customer would like to order another product

whether Cold Coffee or Frapuccino, the same proccess will happen.

39
Figure 4.12 Coffee 19 Coffeeshop Ordering System GUI

Java Codes:

Cold Brew Coffee Button


private void HBCActionPerformed(java.awt.event.ActionEvent evt) {
try {
ps = con.prepareStatement("SELECT ITEM, PRICE FROM PRODUCT WHERE ITEM =
'COLD BREW COFFEE' AND PRICE = 51.00");
ResultSet res = ps.executeQuery();
if(res.next()){
ITEM.setText(res.getString(1));
COST.setText(res.getString(2));
}
}
catch (SQLException e) {
e.printStackTrace();
}
}

Cold Brown Coffee Button

private void HBRCActionPerformed(java.awt.event.ActionEvent evt) {


try {
ps = con.prepareStatement("SELECT ITEM, PRICE FROM PRODUCT WHERE ITEM =
'COLD BROWN COFFEE' AND PRICE = 58.00");
ResultSet res = ps.executeQuery();
if(res.next()){
ITEM.setText(res.getString(1));
COST.setText(res.getString(2));
}
}
catch (SQLException e) {

40
e.printStackTrace();
}
}

Iced Cold Americano Button

private void AActionPerformed(java.awt.event.ActionEvent evt) {


try {
ps = con.prepareStatement("SELECT ITEM, PRICE FROM PRODUCT WHERE ITEM =
'ICED COLD AMERICANO' AND PRICE = 58.00");
ResultSet res = ps.executeQuery();
if(res.next()){
ITEM.setText(res.getString(1));
COST.setText(res.getString(2));
}
}
catch (SQLException e) {
e.printStackTrace();
}
}

Iced Cold Capuccino Button

private void CAPUCCINOActionPerformed(java.awt.event.ActionEvent evt) {


try {
ps = con.prepareStatement("SELECT ITEM, PRICE FROM PRODUCT WHERE ITEM =
'ICED COLD CAPUCCINO' AND PRICE = 64.00");
ResultSet res = ps.executeQuery();
if(res.next()){
ITEM.setText(res.getString(1));
COST.setText(res.getString(2));
}
}
catch (SQLException e) {
e.printStackTrace();
}
}

Iced Cold Latte

private void LATTEActionPerformed(java.awt.event.ActionEvent evt) {


try {
ps = con.prepareStatement("SELECT ITEM, PRICE FROM PRODUCT WHERE ITEM =
'ICED COLD LATTE' AND PRICE = 64.00");
ResultSet res = ps.executeQuery();
if(res.next()){
ITEM.setText(res.getString(1));
COST.setText(res.getString(2));
}
}
catch (SQLException e) {
e.printStackTrace();
}
}

Enter Button

private void jButton7ActionPerformed(java.awt.event.ActionEvent evt) {


int quantity = Integer.parseInt(QUANTITY.getText());
if(quantity > 0 && quantity <= 100){
double Price = Double.parseDouble(COST.getText());
int price = (int) Price;
int Total = price * quantity;
double total = Total;

41
TOTAL.setText(Double.toString(total));
}
else{
JOptionPane.showMessageDialog(null, "Error Order Count!");
}
}

Place Order Button

private void jButton8ActionPerformed(java.awt.event.ActionEvent evt) {


try {
ps = con.prepareStatement("INSERT INTO PURCHASE_DETAIL(USERNAME, ITEM,
QUANTITY, TOTAL, STATUS) values(?,?,?,?, 'NOT_PAID')");
ps.setString(1, USERNAME.getText());
ps.setString(2, ITEM.getText());
ps.setString(3, QUANTITY.getText());
ps.setString(4, TOTAL.getText());
int i = ps.executeUpdate();
if (i != 0) {
JOptionPane.showMessageDialog(null, "Item Succesfully Purchased!");
COLD_COFFEE HC = new COLD_COFFEE();
CC.USERNAME.setText(USERNAME.getText());
CC.show();

dispose();
}
}
catch (SQLException e) {
e.printStackTrace();
}
}

42
Figure 4.13 Coffee 19 Coffeeshop Ordering System GUI

Java Codes:

Java Chip Button

private void HBCActionPerformed(java.awt.event.ActionEvent evt) {


try {
ps = con.prepareStatement("SELECT ITEM, PRICE FROM PRODUCT WHERE ITEM =
'JAVA CHIP' AND PRICE = 82.00");
ResultSet res = ps.executeQuery();
if(res.next()){
ITEM.setText(res.getString(1));
COST.setText(res.getString(2));
}
}
catch (SQLException e) {
e.printStackTrace();
}
}

Espresso Frapuccino Button

private void HBRCActionPerformed(java.awt.event.ActionEvent evt) {


try {
ps = con.prepareStatement("SELECT ITEM, PRICE FROM PRODUCT WHERE ITEM =
'ESPRESSO FRAPUCCINO' AND PRICE = 75.00");
ResultSet res = ps.executeQuery();
if(res.next()){
ITEM.setText(res.getString(1));
COST.setText(res.getString(2));
}
}
catch (SQLException e) {
e.printStackTrace();

43
}
}

Coffee Frapuccino Button

private void AActionPerformed(java.awt.event.ActionEvent evt) {


try {
ps = con.prepareStatement("SELECT ITEM, PRICE FROM PRODUCT WHERE ITEM =
'COFFEE FRAPUCCINO' AND PRICE = 75.00");
ResultSet res = ps.executeQuery();
if(res.next()){
ITEM.setText(res.getString(1));
COST.setText(res.getString(2));
}
}
catch (SQLException e) {
e.printStackTrace();
}
}

Caramel Frapuccino Button

private void CAPUCCINOActionPerformed(java.awt.event.ActionEvent evt) {


try {
ps = con.prepareStatement("SELECT ITEM, PRICE FROM PRODUCT WHERE ITEM =
'CARAMEL FRAPUCCINO' AND PRICE = 82.00");
ResultSet res = ps.executeQuery();
if(res.next()){
ITEM.setText(res.getString(1));
COST.setText(res.getString(2));
}
}
catch (SQLException e) {
e.printStackTrace();
}
}

Mocha Frapuccino Button

private void LATTEActionPerformed(java.awt.event.ActionEvent evt) {


try {
ps = con.prepareStatement("SELECT ITEM, PRICE FROM PRODUCT WHERE ITEM =
'MOCHA FRAPUCCINO' AND PRICE = 82.00");
ResultSet res = ps.executeQuery();
if(res.next()){
ITEM.setText(res.getString(1));
COST.setText(res.getString(2));
}
}
catch (SQLException e) {
e.printStackTrace();
}
}

Enter Button

private void jButton7ActionPerformed(java.awt.event.ActionEvent evt) {


int quantity = Integer.parseInt(QUANTITY.getText());
if(quantity > 0 && quantity <= 100){
double Price = Double.parseDouble(COST.getText());
int price = (int) Price;
int Total = price * quantity;
double total = Total;
TOTAL.setText(Double.toString(total));

44
}
else{
JOptionPane.showMessageDialog(null, "Error Order Count!");
}
}

Place Order Button

private void jButton8ActionPerformed(java.awt.event.ActionEvent evt) {


try {
ps = con.prepareStatement("INSERT INTO PURCHASE_DETAIL(USERNAME, ITEM,
QUANTITY, TOTAL, STATUS) values(?,?,?,?, 'NOT_PAID')");
ps.setString(1, USERNAME.getText());
ps.setString(2, ITEM.getText());
ps.setString(3, QUANTITY.getText());
ps.setString(4, TOTAL.getText());
int i = ps.executeUpdate();
if (i != 0) {
JOptionPane.showMessageDialog(null, "Item Succesfully Purchased!");
FRAPUCCINO F = new FRAPUCCINO();
F.USERNAME.setText(USERNAME.getText());
F.show();

dispose();
}
}
catch (SQLException e) {
e.printStackTrace();
}
}

If the customer would like to check his/her placed orders, the customer can click the the
check order button and it will bring him/her to the check order window. See figure 4.14 and 4.15

Figure 4.14 Coffee 19 Coffeeshop Ordering System GUI

45
Check Order Button Java Code

private void jButton7ActionPerformed(java.awt.event.ActionEvent evt) {


CONFIRM CO = new CONFIRM();
CO.USERNAME.setText(USERNAME.getText());
CO.show();

dispose();

Figure 4.15 Coffee 19 Coffeeshop Ordering System GUI

In this window, a customer can delete order, cancel order, add order if he/she wanted to add

more, or pay the order that the customer made. In deleting the order, the customer should enter the

P_ID from the table shown in the coffe19 customer list of order window from the figure above, and

click the delete order button to delete the choosen ordered product to delete. If the customer

wanted to place another order, he/she can click the add order button. If the customer would like to

cancel the whole transaction or the order he/she made, the customer can click the cancel order

button. And if the Customer want to pay the order he/she made, the customer should click first the

get total button to know the total price of the products he/she orders, enter the payment, and click

46
the confirm order. Now if the customer entered a payment greater than the total, i will display the

chages, If it’s less than the total price, it will display an error message. See figures 4.16 to 4.20.

Figure 4.16 Coffee 19 Coffeeshop Ordering System GUI

47
Figure 4.17 Coffee 19 Coffeeshop Ordering System GUI

Figure 4.18 Coffee 19 Coffeeshop Ordering System GUI

48
Figure 4.19 Coffee 19 Coffeeshop Ordering System GUI

Figure 4.20 Coffee 19 Coffeeshop Ordering System GUI

Java Codes:

49
Table

private void formWindowOpened(java.awt.event.WindowEvent evt) {


// TODO add your handling code here:
String Status = "NOT_PAID";
String User = USERNAME.getText();
try {
ps = con.prepareStatement("SELECT * FROM PURCHASE_DETAIL WHERE USERNAME
= ? AND STATUS = ?");
ps.setString(1, User);
ps.setString(2, Status);
ResultSet res = ps.executeQuery();
DefaultTableModel dmo = (DefaultTableModel)showTable.getModel();
dmo.setRowCount(0);
while(res.next()){
Object o[]={
res.getString("P_ID"),
res.getString("USERNAME"),
res.getString("ITEM"),
res.getString("QUANTITY"),
res.getString("TOTAL"),
res.getString("DATE_OF_PURCHASE"),
res.getString("STATUS")
};
dmo.addRow(o);
}
}
catch (SQLException ex) {
Logger.getLogger(SEARCH.class.getName()).log(Level.SEVERE, null, ex);
}
}

Get Total Button

private void CLOSE4ActionPerformed(java.awt.event.ActionEvent evt) {


try {
ps = con.prepareStatement("SELECT sum(TOTAL) FROM PURCHASE_DETAIL WHERE
USERNAME = ?");
ps.setString(1, USERNAME.getText());
ResultSet res = ps.executeQuery();
while(res.next()){
TOTAL_AMOUNT.setText(res.getString(1));
}

}
catch (SQLException ex) {
Logger.getLogger(SEARCH.class.getName()).log(Level.SEVERE, null, ex);
}
}

Delete Order Button

private void CLOSE2ActionPerformed(java.awt.event.ActionEvent evt) {

try {
ps = con.prepareStatement("DELETE FROM PURCHASE_DETAIL WHERE P_ID =?");
ps.setString(1, USERNAME.getText());
int i = ps.executeUpdate();
if (i != 0) {
JOptionPane.showMessageDialog(null, "Record Deleted!");

}
else {

50
JOptionPane.showMessageDialog(null, "Error Please Try Again!");
}
}
catch (SQLException e) {
e.printStackTrace();
}
}

Cancel Order Button

private void CLOSE1ActionPerformed(java.awt.event.ActionEvent evt) {


try {
ps = con.prepareStatement("DELETE FROM PURCHASE_DETAIL WHERE USERNAME =
? AND P_ID = ? AND STATUS = ?");
ps.setString(1, USERNAME.getText());
ps.setString(2, ID.getText());
ps.setString(3, "NOT_PAID");
ps.executeUpdate();

JOptionPane.showMessageDialog(null, "Record Deleted!");


customer C = new customer();
C.USERNAME.setText(USERNAME.getText());
C.show();

dispose();

}
catch (SQLException e) {
e.printStackTrace();
}
}

Confirm Order Button

private void CLOSEActionPerformed(java.awt.event.ActionEvent evt) {


int ep = Integer.parseInt(PAYMENT.getText());
int total = Integer.parseInt(TOTAL_AMOUNT.getText());

int change = ep - total;

if(ep >= total){


CHANGE.setText(Integer.toString(change));
try {
ps = con.prepareStatement("UPDATE PURCHASE_DETAIL SET STATUS = 'PAID'
WHERE USERNAME = ?");
ps.setString(1, USERNAME.getText());
int i = ps.executeUpdate();
if (i != 0) {
JOptionPane.showMessageDialog(null, "Item Succesfully Purchased!");
CONFIRM CO = new CONFIRM();
CO.USERNAME.setText(USERNAME.getText());
CO.show();

dispose();
}
}
catch (SQLException e) {
e.printStackTrace();
}
}
else{

51
JOptionPane.showMessageDialog(null, "Invalid Amount!");
}

Add Order Button

private void CLOSE3ActionPerformed(java.awt.event.ActionEvent evt) {


customer C = new customer();
C.USERNAME.setText(USERNAME.getText());
C.show();

dispose();

After the transaction, the customer may now either add another order if he/she wanted or log

out if the customer done using the ordering system.

52
Figure 4.21 Coffee 19 Coffeeshop Ordering System GUI

Figure 4.22 Coffee 19 Coffeeshop Ordering System GUI


Log Out Button Java Code

53
private void jButton6ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
USER U = new USER();
U.show();

dispose();
}

ADMIN SIDE

Now as the programmer finished discussing the result of the system in user side, let us now

proceed to the admin side. The following figures the the programmer will show is the screenshot of

GUI of the admin side of the system. Let’s start in Start Up page again where once the admin click

the admin button, the system will show the admin login page where the admin need to enter the

admin’s username and password for he/she could log-in. See figures 5.1 to 5.2.

Figure 5.1 Coffee 19 Coffeeshop Ordering System GUI

Admin Button Java Codes

private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {


// TODO add your handling code here:
LoginForm LF = new LoginForm();
LF.show();

dispose();
}

54
Figure 5.2 Coffee 19 Coffeeshop Ordering System GUI

Figure 5.3 Coffee 19 Coffeeshop Ordering System GUI

55
Login Button Java Codes

private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {


try {

ps = con.prepareStatement("SELECT USERNAME,PASSWORD from ADMIN where


USERNAME = ? AND PASSWORD = ?");
ps.setString(1, LoginForm.USERNAME.getText());
ps.setString(2, LoginForm.PASSWORD.getText());
ResultSet res = ps.executeQuery();
if (res.next()) {
ADMIN_PANEL AP = new ADMIN_PANEL();
AP.show();
dispose();
}
else {
showMessageDialog(null, "incorrect Username or Password!");
}
}
catch (SQLException e) {
e.printStackTrace();
}
}

Figure 5.4 Coffee 19 Coffeeshop Ordering System GUI

Once the admin logged in, the system will redirect him/her to the admin panel windows

where the admin either can check all record that in the database by clicking the show all records

button or browse some important purchase records by clicking the search record.

56
Java Codes

Show All Record Button

private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {


TABLE T = new TABLE();
T.show();

dispose();
}

Search A Record Button

private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {


SEARCH S = new SEARCH();
S.show();

dispose();
}

In the figure 5.5, this window will appear if the admin click the show all record button, where

the admin can see the records inside the table existing in the database of the System or if there’s a

record in purchase detail table and customer account that the admin wanted to delete. See the

following figures 5.5 to 5.12.

57
Figure 5.5 Coffee 19 Coffeeshop Ordering System GUI

58
Figure 5.6 Coffee 19 Coffeeshop Ordering System GUI

Figure 5.7 Coffee 19 Coffeeshop Ordering System GUI

59
Figure 5.8 Coffee 19 Coffeeshop Ordering System GUI

Figure 5.9 Coffee 19 Coffeeshop Ordering System GUI

60
Figure 5.10 Coffee 19 Coffeeshop Ordering System GUI

61
Figure 5.11 Coffee 19 Coffeeshop Ordering System GUI

Figure 5.12 Coffee 19 Coffeeshop Ordering System GUI

In this part of the system in admin side, the admin can delete here a record that shown in

two different table. If the Admin wanted to delete a record from Purchase Detail, he/she should first

chooose the admin option in the Jcombo box beside the delete button, enter the P_ID in the Text

Field, and Delete. The Admin also can delete the entire record on purchase detail record by clicking

the Delete all, where it will truncate all the record in the table from database. The same thing the

admin should do if he/she in Customer Account.

Now if the admin wanted to search or browse a specific record from database, then the

admin should click the search a record button.

62
Figure 5.13 Coffee 19 Coffeeshop Ordering System GUI

63
Figure 5.14 Coffee 19 Coffeeshop Ordering System GUI

In the figure 5.14, as the admin enter for example the word “ICED” in product the table will

automatically display the Purchased Detail the Username of those customer who order the cold

coffee products. In the table we see that there were two records appear, one the iced cold

capuccino and the another one is the iced cold latte where both different products ordered by the

same customer. Now if the admin wanted to now the name of the customer who order the two

different products appears in the table, he/she may search the username shown in the table in

search username field. And also if the admin wanted to know the category of the product, then

he/she can search it by entering the CID shown in the purchase detail table in search category

field. See figure 5.15.

64
Figure 5.15 Coffee 19 Coffeeshop Ordering System GUI

Java Codes:

Search Product Text Field Action

private void TextKeyReleased(java.awt.event.KeyEvent evt) {

try {
ps = con.prepareStatement("SELECT P_ID, PURCHASE_DETAIL.USERNAME,
PURCHASE_DETAIL.ITEM, ID, PRODUCT.C_ID, PRICE, QUANTITY, TOTAL,
DATE_OF_PURCHASE FROM CUSTOMER, PURCHASE_DETAIL, PRODUCT, CATEGORY
WHERE PURCHASE_DETAIL.USERNAME = CUSTOMER.USERNAME AND
PURCHASE_DETAIL.ITEM = PRODUCT.ITEM AND PRODUCT.C_ID = CATEGORY.C_ID AND
PRODUCT.ITEM LIKE ? AND STATUS = 'PAID'");
ps.setString(1, "%" + Text.getText() + "%");
ResultSet res = ps.executeQuery();
DefaultTableModel dmo = (DefaultTableModel)showTable.getModel();
dmo.setRowCount(0);
while(res.next()){
Object o[]={
res.getString("P_ID"),
res.getString("PURCHASE_DETAIL.USERNAME"),
res.getString("PURCHASE_DETAIL.ITEM"),
res.getString("ID"),
res.getString("PRODUCT.C_ID"),
res.getString("PRICE"),
res.getString("QUANTITY"),
res.getString("TOTAL"),
res.getString("DATE_OF_PURCHASE")
};
dmo.addRow(o);
}

65
}
catch (SQLException ex) {
Logger.getLogger(SEARCH.class.getName()).log(Level.SEVERE, null, ex);
}

Search Username Text Field Action

private void USERNAMEKeyReleased(java.awt.event.KeyEvent evt) {

try {
ps = con.prepareStatement("SELECT CS_ID, FULLNAME,USERNAME, FROM
CUSTOMER WHERE USERNAME LIKE ?");
ps.setString(1, "%" + USERNAME.getText() + "%");
ResultSet res = ps.executeQuery();
DefaultTableModel dmo = (DefaultTableModel)CUSTOMER.getModel();
dmo.setRowCount(0);
while(res.next()){
Object o[]={
res.getString("CS_ID"),
res.getString("FULLNAME"),
res.getString("USERNAME"),

};
dmo.addRow(o);
}
}
catch (SQLException ex) {
Logger.getLogger(SEARCH.class.getName()).log(Level.SEVERE, null, ex);
}
}

Search Category(C_ID) Text Field Action

private void CATEGORYIDKeyReleased(java.awt.event.KeyEvent evt) {

try {
ps = con.prepareStatement("SELECT * FROM CATEGORY WHERE C_ID LIKE ?");
ps.setString(1, "%" + CATEGORYID.getText() + "%");
ResultSet res = ps.executeQuery();
DefaultTableModel dmo = (DefaultTableModel)CATEGORY.getModel();
dmo.setRowCount(0);
while(res.next()){
Object o[]={
res.getString("C_ID"),
res.getString("CAT_NAME")
};
dmo.addRow(o);
}
}
catch (SQLException ex) {
Logger.getLogger(SEARCH.class.getName()).log(Level.SEVERE, null, ex);
}
}

66
CONCLUSION

Now a days and in the years to come, this type of system has appeared in the world. It may

be similar to the system presented and discussed by the programmer or it maybe it has a better,

more advanced, or more high-tech features. but we know that while the world is still goes around,

different technologies and different methods of processing things constantly upgrading. For

example, when ordering from fast food chains or buying things that you need, in the old days you

need go to the market to buy what you need to buy, line up at the counter. But now you can go

through the internet or apps, and all you have to do is click some button in the ordering app and

your done. And you just need to wait for the delivery or if you want you can pick it up. Almost

everyone does this when they want to order food or buy their things online when the covid 19

pandemic starts. And also the reason why the programmer name this coffeeshop ordering system

coffee19, its because this system project was created in the midst of covid 19 pandemic. And also

the goal of this ordering system is to provide more convenient and fast services for the users of this

system. Maybe there are more different system in the entire world that provides better sevices for

the user than the programmer’s innovations but all of the programmer’s in world have one thing on

common and goals, and that is to be able to provide a solution that will help people to make it

easier and more convenient for them to process things, like this ordering system.

67

You might also like