forked from PacktPublishing/Java-Coding-Problems
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMelon.java
More file actions
39 lines (29 loc) · 785 Bytes
/
Melon.java
File metadata and controls
39 lines (29 loc) · 785 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
package modern.challenge;
public class Melon {
private final String type;
private int weight;
public Melon(String type, int weight) {
this.type = type;
this.weight = weight;
}
public void eat() {
}
public void weighsIn() {
}
public static void cultivate(Seed seeds) {
System.out.println("The cultivate() method was invoked ...");
}
public static void peel(Slice slice) {
System.out.println("The peel() method was invoked ...");
}
public int getWeight() {
return weight;
}
public void setWeight(int weight) {
this.weight = weight;
}
@Override
public String toString() {
return type + "(" + weight + "g)";
}
}