Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Adam Gerber
/
labJava
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
28d88ead
authored
Nov 09, 2015
by
Adam Gerber
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
decimal format stored once in vending machine
parent
08b37074
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
3 additions
and
3 deletions
src/lec07/glab/vend/Product.java
src/lec07/glab/vend/VendMachine.java
src/lec07/glab/vend/Product.java
View file @
28d88ead
...
...
@@ -13,7 +13,7 @@ public class Product {
private
String
mDesc
;
private
double
mPrice
;
private
static
DecimalFormat
sDecimalFormat
=
new
DecimalFormat
(
"$0.00"
);
//
private static DecimalFormat sDecimalFormat = new DecimalFormat("$0.00");
public
Product
(
String
desc
,
double
price
)
{
mDesc
=
desc
;
...
...
@@ -38,7 +38,7 @@ public class Product {
@Override
public
String
toString
()
{
return
mDesc
+
" "
+
sDecimalFormat
.
format
(
mPrice
);
return
mDesc
+
" "
+
VendMachine
.
sDecimalFormat
.
format
(
mPrice
);
}
}
src/lec07/glab/vend/VendMachine.java
View file @
28d88ead
...
...
@@ -51,7 +51,7 @@ public class VendMachine {
//cash-out
//vend
//show products available
p
rivate
static
DecimalFormat
sDecimalFormat
=
new
DecimalFormat
(
"$0.00"
);
p
ublic
static
DecimalFormat
sDecimalFormat
=
new
DecimalFormat
(
"$0.00"
);
//hold the vending machine's bank
private
List
<
Coin
>
mBanks
;
...
...
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