blob: 9c00d94a49b47aa510fdd143fc40ab9dea12a83b (
plain) (
blame)
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
|
public class CupDemo {
public static void main (String args []) {
//cup init
Cup FirstCup = new Cup();
Cup SecondCup = new Cup(20.0, "Blue", 0.0);
//fill both with 20 oz, this breaks the first cup and will default to the maximum possible capacity
FirstCup.fillCup(20);
SecondCup.fillCup(20);
//print red
System.out.println(FirstCup.status());
//sip and gulp from blue
SecondCup.sip();
SecondCup.sip();
SecondCup.gulp();
//Fill by 6
SecondCup.fillCup(6);
//print blue
System.out.println(SecondCup.status());
//empty red
FirstCup.emptyCup();
//fill red with five
FirstCup.fillCup(5);
//2x gulp first
FirstCup.gulp();
FirstCup.gulp();
//final print
System.out.println(FirstCup.status());
}
}
|