0% found this document useful (0 votes)
11 views17 pages

Final Project in Programming (Chill and Brew

coding

Uploaded by

hona.nikkijean21
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views17 pages

Final Project in Programming (Chill and Brew

coding

Uploaded by

hona.nikkijean21
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 17

Development of The Chill and Brew

Midterm Project
IT 121 Computer Programming II

Developers:
Godilo, Camela
Berania, Joelheen
Fuentes, Paul Cris

BSIT BLOCK 1-2


A.Y. 2022-2023
May 01, 2023
Project description:
The chill and brew is intended to be simple and user-friendly tool that can help any shop employees have
an easy access to any shop orders of the customers. To easily know the amount of each order and the tax
that it contains, where in when customer choose milktea and siomai there are specific amount for each
food and when the server click the specific food the total amount is already given. Chill and brew is
accessible to dekstop and laptops and useful for any shops who want to have an easy access to the
orders of their customers.

Program Objectives:
1. Allows the person assigned in the casher area to have an easy access to the total amount of
orders
- when the customer picks to types of orders the person assigned in the cashier area will have am easily
access to the total amount of the orders.

2. Automatically shows not only the total amount but at the same time the tax.
- in the selection not only, the total amount is provided but at the same time the tax amount.

3. Provides an honest solution of the total amount that the customer needed to pay
- This tool will help the shop to have an honest calculation of the total amount that the customer needed
to pay, at the same time it will help to have an easy access to any orders and less time consuming.

Class Diagram
The “JFrame” class represents the main window of the app. It has-a “JPanel” class that contains
various components such as a “JComboBox”, “TextField”, and “JButton”. The ”JPanel” class has-a
“JTextField” class for the subtotal, tax and total inputs and a “JButton” class for the convert
button enter Button Exit Button and Clear Button.

The “ActionListener” class is responsible for handling the events when the user clicks on the
total button. This Chill and Brew can provides an honest solution of the total amount that the
customer needed to pay. It automatically shows not only the total amount but at the same time
the tax.

Overall, this class diagram shows the relationships between the classes and how they work
together to convert user’s tax and display the results in the user interface.
UI Design
Source Code
public class NewJFrame extends javax.swing.JFrame {

public NewJFrame() {

initComponents();

@SuppressWarnings("unchecked")

// <editor-fold defaultstate="collapsed" desc="Generated Code">

private void initComponents() {

jLabel1 = new javax.swing.JLabel();

redcaramel = new javax.swing.JRadioButton();

avocado = new javax.swing.JRadioButton();

darkchoco = new javax.swing.JRadioButton();

frenchfries = new javax.swing.JCheckBox();

siomai = new javax.swing.JCheckBox();

shawarma = new javax.swing.JCheckBox();

jScrollPane1 = new javax.swing.JScrollPane();

txtsub = new javax.swing.JTextPane();

jScrollPane2 = new javax.swing.JScrollPane();

txttax = new javax.swing.JTextPane();

jScrollPane3 = new javax.swing.JScrollPane();

txtTot = new javax.swing.JTextPane();

jLabel2 = new javax.swing.JLabel();

jLabel3 = new javax.swing.JLabel();

jLabel4 = new javax.swing.JLabel();


btnenter = new javax.swing.JButton();

btnclear = new javax.swing.JButton();

btnexit = new javax.swing.JButton();

setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

setBackground(new java.awt.Color(255, 255, 255));

jLabel1.setBackground(new java.awt.Color(255, 51, 255));

jLabel1.setFont(new java.awt.Font("Arial Rounded MT Bold", 1, 36)); // NOI18N

jLabel1.setForeground(new java.awt.Color(51, 0, 51));

jLabel1.setText("Chill & Brew");

redcaramel.setFont(new java.awt.Font("Lucida Calligraphy", 1, 12)); // NOI18N

redcaramel.setForeground(new java.awt.Color(255, 51, 51));

redcaramel.setText("Red Caramel 39");

redcaramel.addActionListener(new java.awt.event.ActionListener() {

public void actionPerformed(java.awt.event.ActionEvent evt) {

redcaramelActionPerformed(evt);

});

avocado.setFont(new java.awt.Font("Lucida Calligraphy", 1, 12)); // NOI18N

avocado.setForeground(new java.awt.Color(0, 153, 0));

avocado.setText("Avocado 50");

avocado.addActionListener(new java.awt.event.ActionListener() {

public void actionPerformed(java.awt.event.ActionEvent evt) {

avocadoActionPerformed(evt);

});
darkchoco.setFont(new java.awt.Font("Lucida Calligraphy", 1, 12)); // NOI18N

darkchoco.setForeground(new java.awt.Color(0, 0, 0));

darkchoco.setText("Dark Chocolate 29");

darkchoco.addActionListener(new java.awt.event.ActionListener() {

public void actionPerformed(java.awt.event.ActionEvent evt) {

darkchocoActionPerformed(evt);

});

frenchfries.setFont(new java.awt.Font("Lucida Calligraphy", 1, 12)); // NOI18N

frenchfries.setForeground(new java.awt.Color(153, 153, 0));

frenchfries.setText("French Fries 65");

siomai.setFont(new java.awt.Font("Lucida Calligraphy", 1, 12)); // NOI18N

siomai.setForeground(new java.awt.Color(204, 153, 0));

siomai.setText("Siomai 30");

shawarma.setFont(new java.awt.Font("Lucida Calligraphy", 1, 12)); // NOI18N

shawarma.setForeground(new java.awt.Color(0, 102, 102));

shawarma.setText("Shawarma 45");

shawarma.addActionListener(new java.awt.event.ActionListener() {

public void actionPerformed(java.awt.event.ActionEvent evt) {

shawarmaActionPerformed(evt);

});

txtsub.setBackground(new java.awt.Color(255, 204, 204));

jScrollPane1.setViewportView(txtsub);
txttax.setBackground(new java.awt.Color(102, 255, 204));

jScrollPane2.setViewportView(txttax);

txtTot.setBackground(new java.awt.Color(255, 153, 255));

jScrollPane3.setViewportView(txtTot);

jLabel2.setBackground(new java.awt.Color(255, 153, 102));

jLabel2.setForeground(new java.awt.Color(0, 0, 0));

jLabel2.setText("Subtotal");

jLabel3.setForeground(new java.awt.Color(0, 0, 0));

jLabel3.setText("Tax");

jLabel4.setForeground(new java.awt.Color(0, 0, 0));

jLabel4.setText("Total");

btnenter.setBackground(new java.awt.Color(0, 153, 153));

btnenter.setForeground(new java.awt.Color(0, 0, 0));

btnenter.setText("Enter");

btnenter.addActionListener(new java.awt.event.ActionListener() {

public void actionPerformed(java.awt.event.ActionEvent evt) {

btnenterActionPerformed(evt);

});

btnclear.setBackground(new java.awt.Color(204, 255, 204));

btnclear.setForeground(new java.awt.Color(0, 0, 0));

btnclear.setText("Clear");
btnclear.addActionListener(new java.awt.event.ActionListener() {

public void actionPerformed(java.awt.event.ActionEvent evt) {

btnclearActionPerformed(evt);

});

btnexit.setBackground(new java.awt.Color(204, 204, 255));

btnexit.setForeground(new java.awt.Color(0, 0, 0));

btnexit.setText("Exit");

btnexit.addActionListener(new java.awt.event.ActionListener() {

public void actionPerformed(java.awt.event.ActionEvent evt) {

btnexitActionPerformed(evt);

});

javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());

getContentPane().setLayout(layout);

layout.setHorizontalGroup(

layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)

.addGroup(layout.createSequentialGroup()

.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)

.addGroup(layout.createSequentialGroup()

.addGap(61, 61, 61)

.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)

.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING,
false)

.addComponent(redcaramel, javax.swing.GroupLayout.Alignment.LEADING,
javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)

.addComponent(darkchoco, javax.swing.GroupLayout.Alignment.LEADING,
javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addComponent(avocado))

.addGap(74, 74, 74)

.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)

.addComponent(siomai, javax.swing.GroupLayout.PREFERRED_SIZE, 88,


javax.swing.GroupLayout.PREFERRED_SIZE)

.addComponent(frenchfries, javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)

.addComponent(shawarma, javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))

.addGroup(javax.swing.GroupLayout.Alignment.TRAILING,
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)

.addComponent(btnclear)

.addGroup(layout.createSequentialGroup()

.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING,
false)

.addComponent(btnenter, javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)

.addComponent(btnexit, javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))

.addGap(85, 85, 85)

.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)

.addGroup(layout.createSequentialGroup()

.addComponent(jLabel4, javax.swing.GroupLayout.PREFERRED_SIZE, 54,


javax.swing.GroupLayout.PREFERRED_SIZE)

.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)

.addComponent(jScrollPane3, javax.swing.GroupLayout.PREFERRED_SIZE, 101,


javax.swing.GroupLayout.PREFERRED_SIZE))

.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)

.addGroup(javax.swing.GroupLayout.Alignment.TRAILING,
layout.createSequentialGroup()

.addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, 54,


javax.swing.GroupLayout.PREFERRED_SIZE)

.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 101,
javax.swing.GroupLayout.PREFERRED_SIZE))

.addGroup(javax.swing.GroupLayout.Alignment.TRAILING,
layout.createSequentialGroup()

.addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 54,


javax.swing.GroupLayout.PREFERRED_SIZE)

.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)

.addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 101,


javax.swing.GroupLayout.PREFERRED_SIZE)))))))

.addGap(0, 51, Short.MAX_VALUE))

.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()

.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)

.addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 272,


javax.swing.GroupLayout.PREFERRED_SIZE)

.addGap(71, 71, 71))

);

layout.setVerticalGroup(

layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)

.addGroup(layout.createSequentialGroup()

.addGap(15, 15, 15)

.addComponent(jLabel1)

.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)

.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)

.addComponent(redcaramel)

.addComponent(frenchfries))

.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)

.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)

.addComponent(avocado)

.addComponent(siomai))

.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)

.addComponent(darkchoco)

.addComponent(shawarma))

.addGap(26, 26, 26)

.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)

.addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)

.addComponent(jLabel2, javax.swing.GroupLayout.Alignment.TRAILING,
javax.swing.GroupLayout.PREFERRED_SIZE, 22, javax.swing.GroupLayout.PREFERRED_SIZE)

.addComponent(btnenter, javax.swing.GroupLayout.Alignment.TRAILING))

.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)

.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)

.addComponent(jScrollPane2, javax.swing.GroupLayout.Alignment.TRAILING,
javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.PREFERRED_SIZE)

.addGroup(javax.swing.GroupLayout.Alignment.TRAILING,
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)

.addComponent(jLabel3)

.addComponent(btnclear)))

.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)

.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)

.addComponent(jScrollPane3, javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)

.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)

.addComponent(jLabel4)

.addComponent(btnexit)))

.addContainerGap(45, Short.MAX_VALUE))

);

pack();

}// </editor-fold>
private void redcaramelActionPerformed(java.awt.event.ActionEvent evt) {

// selects coffee option

if (redcaramel.isSelected())

avocado.setSelected(false);

darkchoco.setSelected(false);

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

// select Cap

if (avocado.isSelected())

redcaramel.setSelected(false);

darkchoco.setSelected(false);

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

// selects Tea option

if (darkchoco.isSelected())

avocado.setSelected(false);

redcaramel.setSelected(false);

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

// TODO add your handling code here:

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

// TODO add your handling code here:


double Total ;

double Subtotal = 0;

final double Taxrate = .08;

double Tax;

if (redcaramel.isSelected()){

Subtotal = Subtotal + 39;

}else if (avocado.isSelected()){

Subtotal = Subtotal + 50;

}else if (darkchoco.isSelected()){

Subtotal = Subtotal + 29;

if (frenchfries.isSelected()){

Subtotal = Subtotal + 65;

}if (siomai.isSelected()){

Subtotal = Subtotal + 30;

}if (shawarma.isSelected()){

Subtotal = Subtotal + 45;

txtsub.setText(Double.toString(Subtotal));

Subtotal = Double.parseDouble(txtsub.getText());

Tax = Subtotal * Taxrate;

Total = Tax + Subtotal;

txttax.setText(Double.toString(Tax));
txtTot.setText(Double.toString(Total));

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

// exit JFrame

System.exit(0);

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

// Clears all fields

redcaramel.setSelected(false);

darkchoco.setSelected(false);

avocado.setSelected(false);

frenchfries.setSelected(false);

shawarma.setSelected(false);

siomai.setSelected(false);

txtTot.setText("");

txtsub.setText("");

txttax.setText("");

}
/**

* @param args the command line arguments

*/

public static void main(String args[]) {

/* Set the Nimbus look and feel */

//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">

/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.

* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html

*/

try {

for (javax.swing.UIManager.LookAndFeelInfo info :


javax.swing.UIManager.getInstalledLookAndFeels()) {

if ("Nimbus".equals(info.getName())) {

javax.swing.UIManager.setLookAndFeel(info.getClassName());

break;

} catch (ClassNotFoundException ex) {

java.util.logging.Logger.getLogger(NewJFrame.class.getName()).log(java.util.logging.Level.SEVERE,
null, ex);

} catch (InstantiationException ex) {

java.util.logging.Logger.getLogger(NewJFrame.class.getName()).log(java.util.logging.Level.SEVERE,
null, ex);

} catch (IllegalAccessException ex) {

java.util.logging.Logger.getLogger(NewJFrame.class.getName()).log(java.util.logging.Level.SEVERE,
null, ex);

} catch (javax.swing.UnsupportedLookAndFeelException ex) {

java.util.logging.Logger.getLogger(NewJFrame.class.getName()).log(java.util.logging.Level.SEVERE,
null, ex);

}
//</editor-fold>

/* Create and display the form */

java.awt.EventQueue.invokeLater(() -> {

new NewJFrame().setVisible(true);

});

// Variables declaration - do not modify

private javax.swing.JRadioButton avocado;

private javax.swing.JButton btnclear;

private javax.swing.JButton btnenter;

private javax.swing.JButton btnexit;

private javax.swing.JRadioButton darkchoco;

private javax.swing.JCheckBox frenchfries;

private javax.swing.JLabel jLabel1;

private javax.swing.JLabel jLabel2;

private javax.swing.JLabel jLabel3;

private javax.swing.JLabel jLabel4;

private javax.swing.JScrollPane jScrollPane1;

private javax.swing.JScrollPane jScrollPane2;

private javax.swing.JScrollPane jScrollPane3;

private javax.swing.JRadioButton redcaramel;

private javax.swing.JCheckBox shawarma;

private javax.swing.JCheckBox siomai;

private javax.swing.JTextPane txtTot;

private javax.swing.JTextPane txtsub;

private javax.swing.JTextPane txttax;

// End of variables declaration


}

You might also like