Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
COM4001M_Khan_MuhammadAffanHabib
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
affan.khan
COM4001M_Khan_MuhammadAffanHabib
Commits
cd350035
Commit
cd350035
authored
Jan 11, 2021
by
affankhan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
--no commit message
--no commit message
parents
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
946 additions
and
0 deletions
+946
-0
SimpleAddition.java
src/main/java/SimpleAddition.java
+946
-0
No files found.
src/main/java/SimpleAddition.java
0 → 100644
View file @
cd350035
import
java.util.Random
;
import
javax.swing.JOptionPane
;
import
java.io.*
;
import
javax.swing.text.Document
;
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
/**
*
* @author affankhan
*/
public
class
SimpleAddition
extends
javax
.
swing
.
JFrame
{
//let's start by declaring static variables which we will be using
//let's make string variables for all the items
String
pen
=
"Pen, "
;
String
book
=
"Book, "
;
String
water
=
"Water, "
;
String
drink
=
"Drink, "
;
String
snack
=
"Snack, "
;
String
sweet
=
"Sweet, "
;
String
chocolate
=
"Chocolate, "
;
String
biscuits
=
"Biscuits, "
;
String
cake
=
"Cake, "
;
//now lets make int variables
int
penPrice
=
1
;
int
bookPrice
=
1
;
int
waterPrice
=
1
;
int
drinkPrice
=
1
;
int
snackPrice
=
2
;
int
sweetPrice
=
1
;
int
chocolatePrice
=
1
;
int
biscuitsPrice
=
1
;
int
cakePrice
=
2
;
// now lets make int variables of the quantity
int
penQuantity
=
20
;
int
bookQuantity
=
20
;
int
waterQuantity
=
20
;
int
drinkQuantity
=
20
;
int
snackQuantity
=
20
;
int
sweetQuantity
=
20
;
int
chocolateQuantity
=
20
;
int
biscuitsQuantity
=
20
;
int
cakeQuantity
=
20
;
//create int variables for number of each item in the cart
int
penInCart
=
0
;
int
bookInCart
=
0
;
int
waterInCart
=
0
;
int
drinkInCart
=
0
;
int
snackInCart
=
0
;
int
sweetInCart
=
0
;
int
chocolateInCart
=
0
;
int
biscuitsInCart
=
0
;
int
cakeInCart
=
0
;
//now lets make the cart and its price as a variable
String
cart
=
""
;
double
cartPrice
=
0
;
//now lets make a variable for the dropDownMenus
String
dropDownMenu
;
String
itemQuantityString
;
int
itemQuantity
;
//lets create a discount variable
double
discount
=
0
;
//create a string variable which will let costumer's know their discount
String
discountString
=
""
;
/**
* Creates new form SimpleAddition
*/
public
SimpleAddition
()
{
initComponents
();
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings
(
"unchecked"
)
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private
void
initComponents
()
{
Title
=
new
javax
.
swing
.
JLabel
();
askName
=
new
javax
.
swing
.
JLabel
();
nameBox
=
new
javax
.
swing
.
JTextField
();
askPurchase
=
new
javax
.
swing
.
JLabel
();
purchaseOptions
=
new
javax
.
swing
.
JComboBox
<>();
addItemButton
=
new
javax
.
swing
.
JButton
();
removeItemButton
=
new
javax
.
swing
.
JButton
();
proceedToCheckOutButton
=
new
javax
.
swing
.
JButton
();
askBankAmount1
=
new
javax
.
swing
.
JLabel
();
moneyInTheBank
=
new
javax
.
swing
.
JTextField
();
congratulationsLabel
=
new
javax
.
swing
.
JLabel
();
discountButton
=
new
javax
.
swing
.
JButton
();
quantityAdderLabel
=
new
javax
.
swing
.
JLabel
();
itemQuantityDropDown
=
new
javax
.
swing
.
JComboBox
<>();
jScrollPane1
=
new
javax
.
swing
.
JScrollPane
();
cartDisplay
=
new
javax
.
swing
.
JTextArea
();
yourCartLabel
=
new
javax
.
swing
.
JLabel
();
setDefaultCloseOperation
(
javax
.
swing
.
WindowConstants
.
EXIT_ON_CLOSE
);
Title
.
setFont
(
new
java
.
awt
.
Font
(
"Zapfino"
,
1
,
14
));
// NOI18N
Title
.
setForeground
(
new
java
.
awt
.
Color
(
150
,
0
,
0
));
Title
.
setText
(
"Self Checkout System"
);
askName
.
setText
(
"Please enter your name:"
);
askPurchase
.
setText
(
"Please select your purchase:"
);
purchaseOptions
.
setModel
(
new
javax
.
swing
.
DefaultComboBoxModel
<>(
new
String
[]
{
"Pen"
,
"Book"
,
"Water"
,
"Drink"
,
"Snack"
,
"Sweet"
,
"Chocolate "
,
"Biscuits "
,
"Cake"
}));
addItemButton
.
setForeground
(
new
java
.
awt
.
Color
(
0
,
0
,
200
));
addItemButton
.
setText
(
"Add Item"
);
addItemButton
.
addActionListener
(
new
java
.
awt
.
event
.
ActionListener
()
{
public
void
actionPerformed
(
java
.
awt
.
event
.
ActionEvent
evt
)
{
addItemButtonActionPerformed
(
evt
);
}
});
removeItemButton
.
setForeground
(
new
java
.
awt
.
Color
(
200
,
0
,
0
));
removeItemButton
.
setText
(
"Remove Item"
);
removeItemButton
.
addActionListener
(
new
java
.
awt
.
event
.
ActionListener
()
{
public
void
actionPerformed
(
java
.
awt
.
event
.
ActionEvent
evt
)
{
removeItemButtonActionPerformed
(
evt
);
}
});
proceedToCheckOutButton
.
setText
(
"Proceed to Checkout"
);
proceedToCheckOutButton
.
addActionListener
(
new
java
.
awt
.
event
.
ActionListener
()
{
public
void
actionPerformed
(
java
.
awt
.
event
.
ActionEvent
evt
)
{
proceedToCheckOutButtonActionPerformed
(
evt
);
}
});
askBankAmount1
.
setText
(
"Please enter the amount in your bank:"
);
congratulationsLabel
.
setText
(
"Congratulations, You are eligable for a discount raffle! "
);
discountButton
.
setForeground
(
new
java
.
awt
.
Color
(
0
,
102
,
0
));
discountButton
.
setText
(
"Generate Discount"
);
discountButton
.
addActionListener
(
new
java
.
awt
.
event
.
ActionListener
()
{
public
void
actionPerformed
(
java
.
awt
.
event
.
ActionEvent
evt
)
{
discountButtonActionPerformed
(
evt
);
}
});
quantityAdderLabel
.
setText
(
"Please select the quantity you want to add:"
);
itemQuantityDropDown
.
setModel
(
new
javax
.
swing
.
DefaultComboBoxModel
<>(
new
String
[]
{
"1"
,
"2"
,
"3"
,
"4"
,
"5"
,
"6"
,
"7"
,
"8"
,
"9"
,
"10"
,
"11"
,
"12"
,
"13"
,
"14"
,
"15"
,
"16"
,
"17"
,
"18"
,
"19"
,
"20"
}));
cartDisplay
.
setColumns
(
20
);
cartDisplay
.
setRows
(
5
);
jScrollPane1
.
setViewportView
(
cartDisplay
);
yourCartLabel
.
setText
(
"Your Cart:"
);
javax
.
swing
.
GroupLayout
layout
=
new
javax
.
swing
.
GroupLayout
(
getContentPane
());
getContentPane
().
setLayout
(
layout
);
layout
.
setHorizontalGroup
(
layout
.
createParallelGroup
(
javax
.
swing
.
GroupLayout
.
Alignment
.
LEADING
)
.
addGroup
(
layout
.
createSequentialGroup
()
.
addComponent
(
discountButton
,
javax
.
swing
.
GroupLayout
.
DEFAULT_SIZE
,
javax
.
swing
.
GroupLayout
.
DEFAULT_SIZE
,
Short
.
MAX_VALUE
)
.
addPreferredGap
(
javax
.
swing
.
LayoutStyle
.
ComponentPlacement
.
RELATED
)
.
addComponent
(
proceedToCheckOutButton
,
javax
.
swing
.
GroupLayout
.
PREFERRED_SIZE
,
286
,
javax
.
swing
.
GroupLayout
.
PREFERRED_SIZE
)
.
addGap
(
15
,
15
,
15
))
.
addGroup
(
layout
.
createSequentialGroup
()
.
addContainerGap
()
.
addGroup
(
layout
.
createParallelGroup
(
javax
.
swing
.
GroupLayout
.
Alignment
.
LEADING
)
.
addComponent
(
purchaseOptions
,
javax
.
swing
.
GroupLayout
.
PREFERRED_SIZE
,
232
,
javax
.
swing
.
GroupLayout
.
PREFERRED_SIZE
)
.
addComponent
(
congratulationsLabel
)
.
addGroup
(
layout
.
createSequentialGroup
()
.
addGap
(
6
,
6
,
6
)
.
addGroup
(
layout
.
createParallelGroup
(
javax
.
swing
.
GroupLayout
.
Alignment
.
LEADING
)
.
addComponent
(
askPurchase
)
.
addGroup
(
layout
.
createSequentialGroup
()
.
addComponent
(
askName
)
.
addPreferredGap
(
javax
.
swing
.
LayoutStyle
.
ComponentPlacement
.
RELATED
)
.
addGroup
(
layout
.
createParallelGroup
(
javax
.
swing
.
GroupLayout
.
Alignment
.
LEADING
)
.
addComponent
(
Title
)
.
addComponent
(
nameBox
,
javax
.
swing
.
GroupLayout
.
PREFERRED_SIZE
,
177
,
javax
.
swing
.
GroupLayout
.
PREFERRED_SIZE
)))
.
addComponent
(
quantityAdderLabel
)))
.
addGroup
(
layout
.
createSequentialGroup
()
.
addComponent
(
itemQuantityDropDown
,
javax
.
swing
.
GroupLayout
.
PREFERRED_SIZE
,
230
,
javax
.
swing
.
GroupLayout
.
PREFERRED_SIZE
)
.
addPreferredGap
(
javax
.
swing
.
LayoutStyle
.
ComponentPlacement
.
RELATED
)
.
addComponent
(
addItemButton
,
javax
.
swing
.
GroupLayout
.
PREFERRED_SIZE
,
116
,
javax
.
swing
.
GroupLayout
.
PREFERRED_SIZE
)
.
addPreferredGap
(
javax
.
swing
.
LayoutStyle
.
ComponentPlacement
.
RELATED
)
.
addComponent
(
removeItemButton
))
.
addGroup
(
layout
.
createParallelGroup
(
javax
.
swing
.
GroupLayout
.
Alignment
.
TRAILING
,
false
)
.
addComponent
(
jScrollPane1
,
javax
.
swing
.
GroupLayout
.
Alignment
.
LEADING
)
.
addGroup
(
javax
.
swing
.
GroupLayout
.
Alignment
.
LEADING
,
layout
.
createSequentialGroup
()
.
addComponent
(
askBankAmount1
)
.
addPreferredGap
(
javax
.
swing
.
LayoutStyle
.
ComponentPlacement
.
RELATED
)
.
addComponent
(
moneyInTheBank
,
javax
.
swing
.
GroupLayout
.
PREFERRED_SIZE
,
232
,
javax
.
swing
.
GroupLayout
.
PREFERRED_SIZE
)))
.
addComponent
(
yourCartLabel
))
.
addContainerGap
(
8
,
Short
.
MAX_VALUE
))
);
layout
.
setVerticalGroup
(
layout
.
createParallelGroup
(
javax
.
swing
.
GroupLayout
.
Alignment
.
LEADING
)
.
addGroup
(
layout
.
createSequentialGroup
()
.
addContainerGap
()
.
addComponent
(
Title
)
.
addPreferredGap
(
javax
.
swing
.
LayoutStyle
.
ComponentPlacement
.
RELATED
)
.
addGroup
(
layout
.
createParallelGroup
(
javax
.
swing
.
GroupLayout
.
Alignment
.
BASELINE
)
.
addComponent
(
askName
)
.
addComponent
(
nameBox
,
javax
.
swing
.
GroupLayout
.
PREFERRED_SIZE
,
javax
.
swing
.
GroupLayout
.
DEFAULT_SIZE
,
javax
.
swing
.
GroupLayout
.
PREFERRED_SIZE
))
.
addPreferredGap
(
javax
.
swing
.
LayoutStyle
.
ComponentPlacement
.
RELATED
)
.
addComponent
(
askPurchase
)
.
addPreferredGap
(
javax
.
swing
.
LayoutStyle
.
ComponentPlacement
.
RELATED
)
.
addComponent
(
purchaseOptions
,
javax
.
swing
.
GroupLayout
.
PREFERRED_SIZE
,
javax
.
swing
.
GroupLayout
.
DEFAULT_SIZE
,
javax
.
swing
.
GroupLayout
.
PREFERRED_SIZE
)
.
addPreferredGap
(
javax
.
swing
.
LayoutStyle
.
ComponentPlacement
.
RELATED
)
.
addComponent
(
quantityAdderLabel
)
.
addPreferredGap
(
javax
.
swing
.
LayoutStyle
.
ComponentPlacement
.
RELATED
)
.
addGroup
(
layout
.
createParallelGroup
(
javax
.
swing
.
GroupLayout
.
Alignment
.
BASELINE
)
.
addComponent
(
itemQuantityDropDown
,
javax
.
swing
.
GroupLayout
.
PREFERRED_SIZE
,
javax
.
swing
.
GroupLayout
.
DEFAULT_SIZE
,
javax
.
swing
.
GroupLayout
.
PREFERRED_SIZE
)
.
addComponent
(
addItemButton
)
.
addComponent
(
removeItemButton
))
.
addPreferredGap
(
javax
.
swing
.
LayoutStyle
.
ComponentPlacement
.
RELATED
,
8
,
Short
.
MAX_VALUE
)
.
addComponent
(
yourCartLabel
)
.
addPreferredGap
(
javax
.
swing
.
LayoutStyle
.
ComponentPlacement
.
UNRELATED
)
.
addComponent
(
jScrollPane1
,
javax
.
swing
.
GroupLayout
.
PREFERRED_SIZE
,
53
,
javax
.
swing
.
GroupLayout
.
PREFERRED_SIZE
)
.
addPreferredGap
(
javax
.
swing
.
LayoutStyle
.
ComponentPlacement
.
RELATED
)
.
addGroup
(
layout
.
createParallelGroup
(
javax
.
swing
.
GroupLayout
.
Alignment
.
BASELINE
)
.
addComponent
(
askBankAmount1
)
.
addComponent
(
moneyInTheBank
,
javax
.
swing
.
GroupLayout
.
PREFERRED_SIZE
,
javax
.
swing
.
GroupLayout
.
DEFAULT_SIZE
,
javax
.
swing
.
GroupLayout
.
PREFERRED_SIZE
))
.
addGap
(
18
,
18
,
18
)
.
addComponent
(
congratulationsLabel
)
.
addPreferredGap
(
javax
.
swing
.
LayoutStyle
.
ComponentPlacement
.
RELATED
)
.
addGroup
(
layout
.
createParallelGroup
(
javax
.
swing
.
GroupLayout
.
Alignment
.
BASELINE
)
.
addComponent
(
discountButton
)
.
addComponent
(
proceedToCheckOutButton
))
.
addGap
(
16
,
16
,
16
))
);
pack
();
}
// </editor-fold>//GEN-END:initComponents
private
void
proceedToCheckOutButtonActionPerformed
(
java
.
awt
.
event
.
ActionEvent
evt
)
{
//GEN-FIRST:event_proceedToCheckOutButtonActionPerformed
//declare the costumer's bank account balance as a variable
String
accountBalanceString
=
moneyInTheBank
.
getText
();
double
accountBalance
=
Double
.
parseDouble
(
accountBalanceString
);
//declare the costumer name as a variable
String
costumerName
=
nameBox
.
getText
();
//create the if statement for the costumer does not have enough money
if
(
accountBalance
<=
cartPrice
){
JOptionPane
.
showMessageDialog
(
rootPane
,
"You don't have enough funds for the purchase. \n Please ammend your order"
);
}
//end of if statement when the costumer is broke
//create the else statement for when the costumer does have enough money
else
{
double
changeMoney
=
accountBalance
-
cartPrice
;
JOptionPane
.
showMessageDialog
(
rootPane
,
"Your purchase was successful! "
+
" \n Please take your product(s). \n Details can found in the recipt file. "
+
" \n Costumer Name: "
+
costumerName
+
"\n Cart: "
+
cart
+
"\n Discount: "
+
discount
+
"\n Total Cost (with Discount): "
+
cartPrice
+
"\n Amount Paid: "
+
accountBalance
+
"\n Change: "
+
changeMoney
);
//set the variables back to default so other costumers can make their order
penInCart
=
0
;
bookInCart
=
0
;
waterInCart
=
0
;
drinkInCart
=
0
;
snackInCart
=
0
;
sweetInCart
=
0
;
chocolateInCart
=
0
;
biscuitsInCart
=
0
;
cakeInCart
=
0
;
cart
=
""
;
cartPrice
=
0
;
discount
=
0
;
discountString
=
""
;
//empty the card display
cartDisplay
.
setText
(
""
);
}
//end of else statement
}
//GEN-LAST:event_proceedToCheckOutButtonActionPerformed
private
void
addItemButtonActionPerformed
(
java
.
awt
.
event
.
ActionEvent
evt
)
{
//make the value of the drop down box into a String
dropDownMenu
=
String
.
valueOf
(
purchaseOptions
.
getSelectedItem
());
//make the item quantity into a value
itemQuantityString
=
String
.
valueOf
(
itemQuantityDropDown
.
getSelectedItem
());
//now lets parse the itemQuantityString into an integer
itemQuantity
=
Integer
.
parseInt
(
itemQuantityString
);
//create the if statement for the pen drop down
if
(
dropDownMenu
==
"Pen"
){
//create an if statement to ensure that there is enough item in stock
if
(
penQuantity
>=
itemQuantity
){
//create a vatiable of the total amount of pen price
int
penTotalPrice
=
penPrice
*
itemQuantity
;
//add the right amount of money into the sub total price
cartPrice
=
cartPrice
+
penTotalPrice
;
//removing the right amount of pen's from its stock
penQuantity
=
penQuantity
-
itemQuantity
;
//add up all the pens which get added to the costumer's cart
penInCart
=
penInCart
+
itemQuantity
;
//create a for loop so the right number of items are added to the cart
for
(
int
i
=
1
;
i
<=
itemQuantity
;
i
++){
cart
=
cart
+
pen
;
}
//end of the for loop
//append the cart to the text area
cartDisplay
.
setText
(
""
);
cartDisplay
.
append
(
cart
+
"\n Price: $"
+
cartPrice
);
JOptionPane
.
showMessageDialog
(
rootPane
,
"The item(s) has been added to the cart"
);
}
//end of if statement
//create an else statement for when the item is out of stock
else
{
JOptionPane
.
showMessageDialog
(
rootPane
,
"Sorry, this item is out of stock"
);
}
//end of the else statement
}
//end of the pen if statement
//create the if statement for the book drop down
if
(
dropDownMenu
==
"Book"
){
//create an if statement to ensure that there is enough item in stock
if
(
bookQuantity
>=
itemQuantity
){
//create a variable of the total price of the book
int
bookTotalPrice
=
bookPrice
*
itemQuantity
;
//add the right amount money to the subtotal
cartPrice
=
cartPrice
+
bookTotalPrice
;
//reduce the right amount from the item's stock
bookQuantity
=
bookQuantity
-
itemQuantity
;
//add up all the books which get added to the costumer's cart
bookInCart
=
bookInCart
+
itemQuantity
;
//create a for loop so the right number of items are added to the cart
for
(
int
i
=
1
;
i
<=
itemQuantity
;
i
++){
cart
=
cart
+
book
;
}
//end of the for loop
//append the cart to the text area
cartDisplay
.
setText
(
""
);
cartDisplay
.
append
(
cart
+
"\n Price: $"
+
cartPrice
);
JOptionPane
.
showMessageDialog
(
rootPane
,
"The item(s) has been added to the cart"
);
}
//end of if statement
//create the else statement for when the item is out of stock
else
{
JOptionPane
.
showMessageDialog
(
rootPane
,
"Sorry, this item is out of stock"
);
}
//end of the else statement
}
//end of the book if statement
//create the if statement for the water drop down
if
(
dropDownMenu
==
"Water"
){
//create an if statement to ensure that there is enough item in stock
if
(
waterQuantity
>=
itemQuantity
){
//create the variable for the total price of the water
int
waterTotalPrice
=
waterPrice
*
itemQuantity
;
//add the right amount money to the costumer's subtotal
cartPrice
=
cartPrice
+
waterTotalPrice
;
//reduce the right amount from the item's stock
waterQuantity
=
waterQuantity
-
itemQuantity
;
//establish the number of books which get added to the costumer's cart
waterInCart
=
waterInCart
+
itemQuantity
;
//create a for loop so the right number of items are added to the cart
for
(
int
i
=
1
;
i
<=
itemQuantity
;
i
++){
cart
=
cart
+
water
;
}
//end of the for loop
//append the cart to the text area
cartDisplay
.
setText
(
""
);
cartDisplay
.
append
(
cart
+
"\n Price = $ "
+
cartPrice
);
JOptionPane
.
showMessageDialog
(
rootPane
,
"The item(s) has been added to the cart"
);
}
//end of if statement
//create the if statement for the item is out of stock
else
{
JOptionPane
.
showMessageDialog
(
rootPane
,
"Sorry, this item is out of stock"
);
}
//end of the else statement
}
//end of the water if statement
//create the if statement for the drink drop down
if
(
dropDownMenu
==
"Drink"
){
//create an if statement to ensure that there is enough item in stock
if
(
drinkQuantity
>=
itemQuantity
){
//create the variable for the total price of the drink
int
drinkTotalPrice
=
drinkPrice
*
itemQuantity
;
//add the right amount of money in costumers subtotal
cartPrice
=
cartPrice
+
drinkTotalPrice
;
//reduce the right amount from the items stock
drinkQuantity
=
drinkQuantity
-
itemQuantity
;
//establish the right amount of drinks added to the costumer's cart
drinkInCart
=
drinkInCart
+
itemQuantity
;
//create a for loop so the right number of items are added to the cart
for
(
int
i
=
1
;
i
<=
itemQuantity
;
i
++){
cart
=
cart
+
drink
;
}
//end of the for loop
//append the cart to the text area
cartDisplay
.
setText
(
""
);
cartDisplay
.
append
(
cart
+
"\n Price: $"
+
cartPrice
);
JOptionPane
.
showMessageDialog
(
rootPane
,
"The item(s) has been added to the cart"
);
}
//end of if statement
else
{
JOptionPane
.
showMessageDialog
(
rootPane
,
"Sorry, this item is out of stock"
);
}
//end of the else statement
}
//end of the drink if statement
//create the if statement for the snack drop down
if
(
dropDownMenu
==
"Snack"
){
//create an if statement to ensure that there is enough item in stock
if
(
snackQuantity
>=
itemQuantity
){
int
snackTotalPrice
=
snackPrice
*
itemQuantity
;
cartPrice
=
cartPrice
+
snackTotalPrice
;
snackQuantity
=
snackQuantity
-
itemQuantity
;
snackInCart
=
snackInCart
+
itemQuantity
;
//create a for loop so the right number of items are added to the cart
for
(
int
i
=
1
;
i
<=
itemQuantity
;
i
++){
cart
=
cart
+
snack
;
}
//end of the for loop
//append the cart to the text area
cartDisplay
.
setText
(
""
);
cartDisplay
.
append
(
cart
+
"\n Price: $"
+
cartPrice
);
JOptionPane
.
showMessageDialog
(
rootPane
,
"The item(s) has been added to the cart"
);
}
//end of if statement
//create the else statement when the item is out of stock
else
{
JOptionPane
.
showMessageDialog
(
rootPane
,
"Sorry, this item is out of stock"
);
}
//end of the else statement
}
//end of the snack if statement
//create the if statement for the sweet drop down
if
(
dropDownMenu
==
"Sweet"
){
//create an if statement to ensure that there is enough item in stock
if
(
sweetQuantity
>=
itemQuantity
){
//create a variable for the total price of the sweet
int
sweetTotalPrice
=
sweetPrice
*
itemQuantity
;
//add the right amount of money to the costumer's cart
cartPrice
=
cartPrice
+
sweetTotalPrice
;
//reduce the right amount from the stock of the item
sweetQuantity
=
sweetQuantity
-
itemQuantity
;
//establish the amount of sweets get added to the costumer's cart
sweetInCart
=
sweetInCart
+
itemQuantity
;
//create a for loop so the right number of items are added to the cart
for
(
int
i
=
1
;
i
<=
itemQuantity
;
i
++){
cart
=
cart
+
sweet
;
}
//end of the for loop
//append the cart to the text area
cartDisplay
.
setText
(
""
);
cartDisplay
.
append
(
cart
+
"\n Price: $"
+
cartPrice
);
JOptionPane
.
showMessageDialog
(
rootPane
,
"The item(s) has been added to the cart"
);
}
//end of if statement
else
{
JOptionPane
.
showMessageDialog
(
rootPane
,
"Sorry, this item is out of stock"
);
}
//end of the else statement
}
//end of the sweet if statement
//create the if statement for the chocolate drop down
if
(
dropDownMenu
==
"Chocolate"
){
//create an if statement to ensure that there is enough item in stock
if
(
chocolateQuantity
>=
itemQuantity
){
//create the variable for the total price of the chocolate
int
chocolateTotalPrice
=
chocolatePrice
*
itemQuantity
;
//add the right amount of funds to the costumer's subtotal
cartPrice
=
cartPrice
+
chocolateTotalPrice
;
//reduce the stock of the chocolate depening on how much the costumer has bought
chocolateQuantity
=
chocolateQuantity
-
itemQuantity
;
//take account of the number of chocolate which get added to the cart
chocolateInCart
=
chocolateInCart
+
itemQuantity
;
//create a for loop so the right number of items are added to the cart
for
(
int
i
=
1
;
i
<=
itemQuantity
;
i
++){
cart
=
cart
+
chocolate
;
}
//end of the for loop
//append the cart to the text area
cartDisplay
.
setText
(
""
);
cartDisplay
.
append
(
cart
+
"\n Price: $"
+
cartPrice
);
JOptionPane
.
showMessageDialog
(
rootPane
,
"The item(s) has been added to the cart"
);
}
//end of if statement
//make an if statement for when the chocolate is out of stock
else
{
JOptionPane
.
showMessageDialog
(
rootPane
,
"Sorry, this item is out of stock"
);
}
//end of the else statement
}
//end of the chocolate if statement
//create the if statement for the biscuits drop down
if
(
dropDownMenu
==
"Biscuits"
){
//create an if statement to ensure that there is enough item in stock
if
(
biscuitsQuantity
>=
itemQuantity
){
//create a variable for the total price of the biscuits the costumer buys
int
biscuitsTotalPrice
=
biscuitsPrice
*
itemQuantity
;
//add the right amount of funds to the costumer's subtotal
cartPrice
=
cartPrice
+
biscuitsTotalPrice
;
//reduce the right amount of biscuits from its stock
biscuitsQuantity
=
biscuitsQuantity
-
itemQuantity
;
//take account of the biscuits which will be added to the cart
biscuitsInCart
=
biscuitsInCart
+
itemQuantity
;
//create a for loop so the right number of items are added to the cart
for
(
int
i
=
1
;
i
<=
itemQuantity
;
i
++){
cart
=
cart
+
biscuits
;
}
//end of the for loop
//append the cart to the text area
cartDisplay
.
setText
(
""
);
cartDisplay
.
append
(
cart
+
"\n Price: $"
+
cartPrice
);
JOptionPane
.
showMessageDialog
(
rootPane
,
"The item(s) has been added to the cart"
);
}
//end of if statement
//create the else statement when the item is out of stock
else
{
JOptionPane
.
showMessageDialog
(
rootPane
,
"Sorry, this item is out of stock"
);
}
//end of the else statement
}
//end of the biscuits if statement
//create the if statement for the cake drop down
if
(
dropDownMenu
==
"Cake"
){
//create an if statement to ensure that there is enough item in stock
if
(
cakeQuantity
>=
itemQuantity
){
//create a variable of the total price of the cake
int
cakeTotalPrice
=
cakePrice
*
itemQuantity
;
//add the right amount of funds to the subtotal of the costumer
cartPrice
=
cartPrice
+
cakeTotalPrice
;
//reduce the right amount of cake from it's stock
cakeQuantity
=
cakeQuantity
-
itemQuantity
;
//take account of the number of the cake which gets added to the costumer's cart
cakeInCart
=
cakeInCart
+
itemQuantity
;
//create a for loop so the right number of items are added to the cart
for
(
int
i
=
1
;
i
<=
itemQuantity
;
i
++){
cart
=
cart
+
cake
;
}
//end of the for loop
//append the cart to the text area
cartDisplay
.
setText
(
""
);
cartDisplay
.
append
(
cart
+
"\n Price: $"
+
cartPrice
);
JOptionPane
.
showMessageDialog
(
rootPane
,
"The item(s) has been added to the cart"
);
}
//end of if statement
//create an else statement when the cake is out of stock
else
{
JOptionPane
.
showMessageDialog
(
rootPane
,
"Sorry, this item is out of stock"
);
}
//end of the else statement
}
//end of the cake if statement
}
//GEN-LAST:event_addItemButtonActionPerformed
private
void
removeItemButtonActionPerformed
(
java
.
awt
.
event
.
ActionEvent
evt
)
{
//GEN-FIRST:event_removeItemButtonActionPerformed
//make the value of the drop down box into a String
dropDownMenu
=
String
.
valueOf
(
purchaseOptions
.
getSelectedItem
());
//make the item quantity into a value
itemQuantityString
=
String
.
valueOf
(
itemQuantityDropDown
.
getSelectedItem
());
//now lets parse the itemQuantityString into an integer
itemQuantity
=
Integer
.
parseInt
(
itemQuantityString
);
//create the if statement for removing pen
if
(
dropDownMenu
==
"Pen"
){
//create the if statement to make sure the cart has enough items
if
(
itemQuantity
<=
penInCart
){
//create the total price of the pen a variable
int
penTotalPrice
=
penPrice
*
itemQuantity
;
//subtract the right amount from the subtotal
cartPrice
=
cartPrice
-
penTotalPrice
;
//add the removed items back to the cart
penQuantity
=
penQuantity
+
itemQuantity
;
//create the for loop for removing the desired no. of items from cart
for
(
int
i
=
1
;
i
<=
itemQuantity
;
i
++){
cart
=
cart
.
replaceFirst
(
"Pen, "
,
""
);
}
//end of for loop
//set the display area to an empty cart and then replace it with cart
cartDisplay
.
setText
(
""
);
cartDisplay
.
append
(
cart
+
"\n Price: $"
+
cartPrice
);
}
//end of the enough items if statement
//create the else statement to show an error message the cart does not have enough items
else
{
JOptionPane
.
showMessageDialog
(
rootPane
,
"Your cart does not have enough items."
);
}
//end of else if statement
}
//end of removing pen if statement
//create the if statement for removing book
if
(
dropDownMenu
==
"Book"
){
//create the if statement to make sure the cart has enough items
if
(
itemQuantity
<=
bookInCart
){
//create the total price of the pen a variable
int
bookTotalPrice
=
bookPrice
*
itemQuantity
;
//subtract the right amount from the subtotal
cartPrice
=
cartPrice
-
bookTotalPrice
;
//add the removed items back to the cart
bookQuantity
=
bookQuantity
+
itemQuantity
;
//create the for loop for removing the desired no. of items from cart
for
(
int
i
=
1
;
i
<=
itemQuantity
;
i
++){
cart
=
cart
.
replaceFirst
(
"Book, "
,
""
);
}
//end of for loop
//set the display area to an empty cart and then replace it with cart
cartDisplay
.
setText
(
""
);
cartDisplay
.
append
(
cart
+
"\n Price: $"
+
cartPrice
);
}
//end of the enough items if statement
//create the else statement to show an error message the cart does not have enough items
else
{
JOptionPane
.
showMessageDialog
(
rootPane
,
"Your cart does not have enough items."
);
}
//end of else if statement
}
//end of removing book if statement
//create the if statement for removing water
if
(
dropDownMenu
==
"Water"
){
//create the if statement to make sure the cart has enough items
if
(
itemQuantity
<=
waterInCart
){
//create the total price of the pen a variable
int
waterTotalPrice
=
waterPrice
*
itemQuantity
;
//subtract the right amount from the subtotal
cartPrice
=
cartPrice
-
waterTotalPrice
;
//add the removed items back to the cart
waterQuantity
=
waterQuantity
+
itemQuantity
;
//create the for loop for removing the desired no. of items from cart
for
(
int
i
=
1
;
i
<=
itemQuantity
;
i
++){
cart
=
cart
.
replaceFirst
(
"Water, "
,
""
);
}
//end of for loop
//set the display area to an empty cart and then replace it with cart
cartDisplay
.
setText
(
""
);
cartDisplay
.
append
(
cart
+
"\n Price: $"
+
cartPrice
);
}
//end of the enough items if statement
//create the else statement to show an error message the cart does not have enough items
else
{
JOptionPane
.
showMessageDialog
(
rootPane
,
"Your cart does not have enough items."
);
}
//end of else if statement
}
//end of removing water if statement
//create the if statement for removing drink
if
(
dropDownMenu
==
"Drink"
){
//create the if statement to make sure the cart has enough items
if
(
itemQuantity
<=
drinkInCart
){
//create the total price of the pen a variable
int
drinkTotalPrice
=
drinkPrice
*
itemQuantity
;
//subtract the right amount from the subtotal
cartPrice
=
cartPrice
-
drinkTotalPrice
;
//add the removed items back to the cart
drinkQuantity
=
drinkQuantity
+
itemQuantity
;
//create the for loop for removing the desired no. of items from cart
for
(
int
i
=
1
;
i
<=
itemQuantity
;
i
++){
cart
=
cart
.
replaceFirst
(
"Drink, "
,
""
);
}
//end of for loop
//set the display area to an empty cart and then replace it with cart
cartDisplay
.
setText
(
""
);
cartDisplay
.
append
(
cart
+
"\n Price: $"
+
cartPrice
);
}
//end of the enough items if statement
//create the else statement to show an error message the cart does not have enough items
else
{
JOptionPane
.
showMessageDialog
(
rootPane
,
"Your cart does not have enough items."
);
}
//end of else if statement
}
//end of removing drink if statement
//create the if statement for removing snack
if
(
dropDownMenu
==
"Snack"
){
//create the if statement to make sure the cart has enough items
if
(
itemQuantity
<=
snackInCart
){
//create the total price of the pen a variable
int
snackTotalPrice
=
snackPrice
*
itemQuantity
;
//subtract the right amount from the subtotal
cartPrice
=
cartPrice
-
snackTotalPrice
;
//add the removed items back to the cart
snackQuantity
=
snackQuantity
+
itemQuantity
;
//create the for loop for removing the desired no. of items from cart
for
(
int
i
=
1
;
i
<=
itemQuantity
;
i
++){
cart
=
cart
.
replaceFirst
(
"Snack, "
,
""
);
}
//end of for loop
//set the display area to an empty cart and then replace it with cart
cartDisplay
.
setText
(
""
);
cartDisplay
.
append
(
cart
+
"\n Price: $"
+
cartPrice
);
}
//end of the enough items if statement
//create the else statement to show an error message the cart does not have enough items
else
{
JOptionPane
.
showMessageDialog
(
rootPane
,
"Your cart does not have enough items."
);
}
//end of else if statement
}
//end of removing snack if statement
//create the if statement for removing sweet
if
(
dropDownMenu
==
"Sweet"
){
//create the if statement to make sure the cart has enough items
if
(
itemQuantity
<=
sweetInCart
){
//create the total price of the pen a variable
int
sweetTotalPrice
=
sweetPrice
*
itemQuantity
;
//subtract the right amount from the subtotal
cartPrice
=
cartPrice
-
sweetTotalPrice
;
//add the removed items back to the cart
sweetQuantity
=
sweetQuantity
+
itemQuantity
;
//create the for loop for removing the desired no. of items from cart
for
(
int
i
=
1
;
i
<=
itemQuantity
;
i
++){
cart
=
cart
.
replaceFirst
(
"Sweet, "
,
""
);
}
//end of for loop
//set the display area to an empty cart and then replace it with cart
cartDisplay
.
setText
(
""
);
cartDisplay
.
append
(
cart
+
"\n Price: $"
+
cartPrice
);
}
//end of the enough items if statement
//create the else statement to show an error message the cart does not have enough items
else
{
JOptionPane
.
showMessageDialog
(
rootPane
,
"Your cart does not have enough items."
);
}
//end of else if statement
}
//end of removing sweet if statement
//create the if statement for removing chocolate
if
(
dropDownMenu
==
"Chocolate"
){
//create the if statement to make sure the cart has enough items
if
(
itemQuantity
<=
chocolateInCart
){
//create the total price of the pen a variable
int
chocolateTotalPrice
=
chocolatePrice
*
itemQuantity
;
//subtract the right amount from the subtotal
cartPrice
=
cartPrice
-
chocolateTotalPrice
;
//add the removed items back to the cart
chocolateQuantity
=
chocolateQuantity
+
itemQuantity
;
//create the for loop for removing the desired no. of items from cart
for
(
int
i
=
1
;
i
<=
itemQuantity
;
i
++){
cart
=
cart
.
replaceFirst
(
"Chocolate, "
,
""
);
}
//end of for loop
//set the display area to an empty cart and then replace it with cart
cartDisplay
.
setText
(
""
);
cartDisplay
.
append
(
cart
+
"\n Price: $"
+
cartPrice
);
}
//end of the enough items if statement
//create the else statement to show an error message the cart does not have enough items
else
{
JOptionPane
.
showMessageDialog
(
rootPane
,
"Your cart does not have enough items."
);
}
//end of else if statement
}
//end of removing chocolate if statement
//create the if statement for removing biscuits
if
(
dropDownMenu
==
"Biscuits"
){
//create the if statement to make sure the cart has enough items
if
(
itemQuantity
<=
biscuitsInCart
){
//create the total price of the pen a variable
int
biscuitsTotalPrice
=
biscuitsPrice
*
itemQuantity
;
//subtract the right amount from the subtotal
cartPrice
=
cartPrice
-
biscuitsTotalPrice
;
//add the removed items back to the cart
biscuitsQuantity
=
biscuitsQuantity
+
itemQuantity
;
//create the for loop for removing the desired no. of items from cart
for
(
int
i
=
1
;
i
<=
itemQuantity
;
i
++){
cart
=
cart
.
replaceFirst
(
"Biscuits, "
,
""
);
}
//end of for loop
//set the display area to an empty cart and then replace it with cart
cartDisplay
.
setText
(
""
);
cartDisplay
.
append
(
cart
+
"\n Price: $"
+
cartPrice
);
}
//end of the enough items if statement
//create the else statement to show an error message the cart does not have enough items
else
{
JOptionPane
.
showMessageDialog
(
rootPane
,
"Your cart does not have enough items."
);
}
//end of else if statement
}
//end of removing biscuits if statement
//create the if statement for removing cake
if
(
dropDownMenu
==
"Cake"
){
//create the if statement to make sure the cart has enough items
if
(
itemQuantity
<=
cakeInCart
){
//create the total price of the pen a variable
int
cakeTotalPrice
=
cakePrice
*
itemQuantity
;
//subtract the right amount from the subtotal
cartPrice
=
cartPrice
-
cakeTotalPrice
;
//add the removed items back to the cart
cakeQuantity
=
cakeQuantity
+
itemQuantity
;
//create the for loop for removing the desired no. of items from cart
for
(
int
i
=
1
;
i
<=
itemQuantity
;
i
++){
cart
=
cart
.
replaceFirst
(
"Cake, "
,
""
);
}
//end of for loop
//set the display area to an empty cart and then replace it with cart
cartDisplay
.
setText
(
""
);
cartDisplay
.
append
(
cart
+
"\n Price: $"
+
cartPrice
);
}
//end of the enough items if statement
//create the else statement to show an error message the cart does not have enough items
else
{
JOptionPane
.
showMessageDialog
(
rootPane
,
"Your cart does not have enough items."
);
}
//end of else if statement
}
//end of removing cake if statement
}
//GEN-LAST:event_removeItemButtonActionPerformed
private
void
discountButtonActionPerformed
(
java
.
awt
.
event
.
ActionEvent
evt
)
{
//GEN-FIRST:event_discountButtonActionPerformed
// create a random integer
Random
randomNumberGenerator
=
new
Random
();
//assign the random number generator in a variable between 1 and 10
int
randomNumber
=
randomNumberGenerator
.
nextInt
(
10
)
+
1
;
//create an if statement so the costumer's can't get a discount an account again
if
(
discount
==
0
){
//assign the corresponding values to the discount variable
//if statement for when the random number is 1
if
(
randomNumber
==
1
){
discount
=
0.1
;
//we will multiply this discount with the cart price
//assign the value to the discount String
discountString
=
"Congratulations, you get a discount of 10%."
;
//create the pop up to show the costumer what their discount is
JOptionPane
.
showMessageDialog
(
rootPane
,
discountString
);
//ammend the cart price
cartPrice
=
cartPrice
-
(
cartPrice
*
discount
);
//ammend the display of the cart with the updated price
cartDisplay
.
setText
(
""
);
cartDisplay
.
append
(
cart
+
"\n Price: $"
+
cartPrice
+
"\n Discount Applied!"
);
}
//end of if statement for the random number being 1
//if statement for when the random number is 2
if
(
randomNumber
==
2
){
discount
=
0.2
;
//we will multiply this discount with the cart price
//assign the value to the discount String
discountString
=
"Congratulations, you get a discount of 20%."
;
//create the pop up to show the costumer what their discount is
JOptionPane
.
showMessageDialog
(
rootPane
,
discountString
);
//ammend the cart price
cartPrice
=
cartPrice
-
(
cartPrice
*
discount
);
//ammend the display of the cart with the updated price
cartDisplay
.
setText
(
""
);
cartDisplay
.
append
(
cart
+
"\n Price: $"
+
cartPrice
+
"\n Discount Applied!"
);
}
//end of if statement for the random number being 2
//if statement for when the random number is 3
if
(
randomNumber
==
3
){
discount
=
0.3
;
//we will multiply this discount with the cart price
//assign the value to the discount String
discountString
=
"Congratulations, you get a discount of 30%."
;
//create the pop up to show the costumer what their discount is
JOptionPane
.
showMessageDialog
(
rootPane
,
discountString
);
//ammend the cart price
cartPrice
=
cartPrice
-
(
cartPrice
*
discount
);
//ammend the display of the cart with the updated price
cartDisplay
.
setText
(
""
);
cartDisplay
.
append
(
cart
+
"\n Price: $"
+
cartPrice
+
"\n Discount Applied!"
);
}
//end of if statement for the random number being 3
//if statement for when the random number is 4
if
(
randomNumber
==
4
){
discount
=
0.4
;
//we will multiply this discount with the cart price
//assign the value to the discount String
discountString
=
"Congratulations, you get a discount of 40%."
;
//create the pop up to show the costumer what their discount is
JOptionPane
.
showMessageDialog
(
rootPane
,
discountString
);
//ammend the cart price
cartPrice
=
cartPrice
-
(
cartPrice
*
discount
);
//ammend the display of the cart with the updated price
cartDisplay
.
setText
(
""
);
cartDisplay
.
append
(
cart
+
"\n Price: $"
+
cartPrice
+
"\n Discount Applied!"
);
}
//end of if statement for the random number being 4
//if statement for when the random number is 5
if
(
randomNumber
==
5
){
discount
=
0.5
;
//we will multiply this discount with the cart price
//assign the value to the discount String
discountString
=
"Congratulations, you get a discount of 50%."
;
//create the pop up to show the costumer what their discount is
JOptionPane
.
showMessageDialog
(
rootPane
,
discountString
);
//ammend the cart price
cartPrice
=
cartPrice
-
(
cartPrice
*
discount
);
//ammend the display of the cart with the updated price
cartDisplay
.
setText
(
""
);
cartDisplay
.
append
(
cart
+
"\n Price: $"
+
cartPrice
+
"\n Discount Applied!"
);
}
//end of if statement for the random number is 5
//if statement for when the random number is 6-10
if
(
randomNumber
>=
6
){
discount
=
5
;
//we will multiply this discount with the cart price
//instead of mutiplying this discount with the cart price we will subtract it.
//assign the value to the discount String
discountString
=
"Congratulations, you get a discount of $5."
;
//create the pop up to show the costumer what their discount is
JOptionPane
.
showMessageDialog
(
rootPane
,
discountString
);
//create the if statement for when the cart price is less than 5
if
(
cartPrice
<=
5
){
//update the cart price to 0
cartPrice
=
0
;
//ammend the display of the cart with the updated price
cartDisplay
.
setText
(
""
);
cartDisplay
.
append
(
cart
+
"\n Price: $"
+
cartPrice
+
"\n Discount Applied!"
);
}
//end of the if statement for the cart price being less than 5
//create the else statement for when the cart price is greater than 5
else
{
//subtract 5 from the cart price
cartPrice
=
cartPrice
-
5
;
//amment the display of the cart with the updated price
cartDisplay
.
setText
(
""
);
cartDisplay
.
append
(
cart
+
"\n Price: $"
+
cartPrice
+
"\n Discount Applied!"
);
}
//end of the else statement
}
//end of if statement for the random number being 2
}
//end of if statement so the costumer's cant get discount again
//create the else statement if they try to get a better discount
else
{
//show the pop up of the same discount
JOptionPane
.
showMessageDialog
(
rootPane
,
discountString
);
}
//end of the else statement
}
//GEN-LAST:event_discountButtonActionPerformed
/**
* @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
(
SimpleAddition
.
class
.
getName
()).
log
(
java
.
util
.
logging
.
Level
.
SEVERE
,
null
,
ex
);
}
catch
(
InstantiationException
ex
)
{
java
.
util
.
logging
.
Logger
.
getLogger
(
SimpleAddition
.
class
.
getName
()).
log
(
java
.
util
.
logging
.
Level
.
SEVERE
,
null
,
ex
);
}
catch
(
IllegalAccessException
ex
)
{
java
.
util
.
logging
.
Logger
.
getLogger
(
SimpleAddition
.
class
.
getName
()).
log
(
java
.
util
.
logging
.
Level
.
SEVERE
,
null
,
ex
);
}
catch
(
javax
.
swing
.
UnsupportedLookAndFeelException
ex
)
{
java
.
util
.
logging
.
Logger
.
getLogger
(
SimpleAddition
.
class
.
getName
()).
log
(
java
.
util
.
logging
.
Level
.
SEVERE
,
null
,
ex
);
}
//</editor-fold>
/* Create and display the form */
java
.
awt
.
EventQueue
.
invokeLater
(
new
Runnable
()
{
public
void
run
()
{
new
SimpleAddition
().
setVisible
(
true
);
}
});
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private
javax
.
swing
.
JLabel
Title
;
private
javax
.
swing
.
JButton
addItemButton
;
private
javax
.
swing
.
JLabel
askBankAmount1
;
private
javax
.
swing
.
JLabel
askName
;
private
javax
.
swing
.
JLabel
askPurchase
;
private
javax
.
swing
.
JTextArea
cartDisplay
;
private
javax
.
swing
.
JLabel
congratulationsLabel
;
private
javax
.
swing
.
JButton
discountButton
;
private
javax
.
swing
.
JComboBox
<
String
>
itemQuantityDropDown
;
private
javax
.
swing
.
JScrollPane
jScrollPane1
;
private
javax
.
swing
.
JTextField
moneyInTheBank
;
private
javax
.
swing
.
JTextField
nameBox
;
private
javax
.
swing
.
JButton
proceedToCheckOutButton
;
private
javax
.
swing
.
JComboBox
<
String
>
purchaseOptions
;
private
javax
.
swing
.
JLabel
quantityAdderLabel
;
private
javax
.
swing
.
JButton
removeItemButton
;
private
javax
.
swing
.
JLabel
yourCartLabel
;
// End of variables declaration//GEN-END:variables
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment