-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathIceCream.java
More file actions
52 lines (30 loc) · 909 Bytes
/
Copy pathIceCream.java
File metadata and controls
52 lines (30 loc) · 909 Bytes
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
import java.util.ArrayList;
public class IceCream {
private String name;
private int cost;
private int numScoops;
private ArrayList<String> toppings;
public IceCream(String name, int cost, int numScoops) {
this.name = name;
this.cost = cost;
this.numScoops = numScoops;
this.toppings = new ArrayList<>();
}//end IceCream ctor
public void addTopping(String topping) {
toppings.add(topping);
}//end addTopping
public String getName() {
return name;
}
public int getCost() {
return cost;
}
public int getNumScoops() {
return numScoops;
}
public void printToppings() {
for(String topping : toppings) {
System.out.println("\t" + topping);
}//end for
}//end printToppings
}//end class