Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
VendingMachine_Thomas_Barraclough_Resit
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
thomas.barraclough
VendingMachine_Thomas_Barraclough_Resit
Commits
0732ab89
Commit
0732ab89
authored
May 01, 2020
by
Tom
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Vending Machine Resit
parent
d9606378
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
2 deletions
+15
-2
VendingMachineClass.java
src/VendingMachineClass.java
+15
-2
No files found.
src/VendingMachineClass.java
View file @
0732ab89
...
@@ -131,10 +131,23 @@ public class VendingMachineClass extends javax.swing.JFrame implements ActionLis
...
@@ -131,10 +131,23 @@ public class VendingMachineClass extends javax.swing.JFrame implements ActionLis
}
}
//If the purchased button is clicked the following will happen
if
(
e
.
getActionCommand
().
equals
(
"Purchase"
))
{
jTextField3
.
setText
(
jComboBox1
.
getSelectedItem
().
toString
()
+
" Purchased"
);
//every time the button is clicked, the cost will go up by 1 and the stock will go down by 1
cost
=
cost
+
1
;
stock
=
stock
-
1
;
jTextField2
.
setText
(
""
+
cost
);
}
if
(
stock
==
0
)
{
jTextArea1
.
setText
(
"Sorry, we are currently out of stock"
);
}
if
(
e
.
getActionCommand
().
equals
(
"Cost"
))
{
if
(
e
.
getActionCommand
().
equals
(
"Cost"
))
{
System
.
out
.
print
(
"Test"
);
jTextArea1
.
setText
(
"That Will be "
+
cost
+
"!\n\nThank You For Your Purchase"
);
System
.
out
.
print
(
"Working"
);
cost
=
0
;
}
}
}
}
...
...
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