forked from angiejones/java-programming
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMarket.java
More file actions
31 lines (22 loc) · 642 Bytes
/
Copy pathMarket.java
File metadata and controls
31 lines (22 loc) · 642 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
package exercises.chapter10;
public class Market {
public static void main(String[] args){
Fruit apple = new Apple();
((Apple) apple).removeSeeds();
Apple apple2 = new Apple();
apple2.removeSeeds();
Banana banana = new Banana();
banana.peel();
Fruit banana2 = new Banana();
((Banana) banana2).peel();
Fruit orange = new Fruit();
squeeze(apple);
squeeze(banana);
squeeze(banana2);
squeeze(orange);
}
public static void squeeze(Fruit fruit){
System.out.print("Squeezing...");
fruit.makeJuice();
}
}