Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
VendingMachine_Andrea_Munoz-White
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
andrea.munoz-whiteside
VendingMachine_Andrea_Munoz-White
Commits
2de7299d
Commit
2de7299d
authored
Jan 07, 2020
by
andrea.munoz-white
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Vending Machine
parent
f41cfa35
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
6 deletions
+14
-6
VendingMachine.form
src/main/java/VendingMachine.form
+0
-0
VendingMachine.java
src/main/java/VendingMachine.java
+14
-6
No files found.
src/main/java/
com/journaldev/files/
VendingMachine.form
→
src/main/java/VendingMachine.form
View file @
2de7299d
File moved
src/main/java/
com/journaldev/files/
VendingMachine.java
→
src/main/java/VendingMachine.java
View file @
2de7299d
...
...
@@ -14,6 +14,8 @@ import java.io.FileWriter;
import
java.io.PrintWriter
;
import
java.io.IOException
;
import
java.io.File
;
import
java.util.logging.Level
;
import
java.util.logging.Logger
;
//used to create a file
public
class
VendingMachine
extends
javax
.
swing
.
JFrame
{
...
...
@@ -277,12 +279,18 @@ public class VendingMachine extends javax.swing.JFrame {
File
file
=
new
File
(
"/Users/andrea.munoz-white/Documents/reciept.txt"
);
//Creates a file in the specified direcotry
try
{
FileWriter
writer
=
new
FileWriter
(
file
);
writer
.
write
(
"Order : \n"
+
SelectedProducts
.
getText
()
+
"\nEntered Amount (£): "
+
amount
+
"\nTotal Price (£): "
+
cost
+
"\nChange Due (£): "
+
change1
);
writer
.
close
();
writer
.
write
(
"Order : \n"
+
SelectedProducts
.
getText
()
+
"\nEntered Amount (£): "
+
amount
+
"\nTotal Price (£): "
+
cost
+
"\nChange Due (£): "
+
change1
);
writer
.
close
();
}
catch
(
IOException
ex
)
{
Logger
.
getLogger
(
VendingMachine
.
class
.
getName
()).
log
(
Level
.
SEVERE
,
null
,
ex
);
}
//used this webpage for refrence https://www.journaldev.com/20891/java-filewriter-example
emptytext
();
// calls the method empty text
...
...
@@ -292,7 +300,7 @@ public class VendingMachine extends javax.swing.JFrame {
// if the user input amount is less than the total amount then the program prints that the user doesn't have enough money.
}
}
//GEN-LAST:event_jButton2ActionPerformed
}
/**
* @param args the command line arguments
*/
...
...
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