-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathObjectPractice.java
More file actions
30 lines (28 loc) · 879 Bytes
/
ObjectPractice.java
File metadata and controls
30 lines (28 loc) · 879 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
public class ObjectPractice {
class Main {
public static void main(String[] args) {
LemonadeStand.makeLemonade();
LemonadeStand.makeLemonade();
LemonadeStand.makeLemonade();
LemonadeStand.checkInventory();
}
}
class LemonadeStand {
public static void makeLemonade() {
Inventory.lemons -= 1;
Inventory.water -= 1;
Inventory.sugar -= 1;
}
public static void checkInventory() {
System.out.println("Lemons: " + Inventory.lemons);
System.out.println("Water: " + Inventory.lemons);
System.out.println("Sugar: " + Inventory.lemons);
}
}
// Continued
class Inventory {
public static int lemons = 10;
public static int water = 10;
public static int sugar = 10;
}
}