-
Notifications
You must be signed in to change notification settings - Fork 0
/
Stockpile.java
55 lines (42 loc) · 899 Bytes
/
Stockpile.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
package vendingMachine;
public class Stockpile {
int count;
double price;
int id;
/**
* @param count : This is the number of sodas of a this type
* @param price : This is the price of this type of soda
* @param id : This is the id of this type of soda
*/
public Stockpile(int count, double price, int id) {
this.count = count;
this.price = price;
this.id = id;
}
/**
* Removes one soda from this stockpile
*/
public void removeSoda() {
count--;
}
/**
* @return returns true if there are no sodas left and false otherwise
*/
public boolean isEmpty() {
if(count <= 0)
return true;
return false;
}
/**
* @return returns price of the soda
*/
public double getPrice() {
return price;
}
/**
* @return returns id of the soda
*/
public int getId() {
return id;
}
}