-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFlower.java
More file actions
37 lines (27 loc) · 919 Bytes
/
Flower.java
File metadata and controls
37 lines (27 loc) · 919 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
// First, you need to implement a derived Flower class, given a base Plant class
public class Flower extends Plant {
protected boolean isAnnual;
protected String colorOfFlowers;
// Use the UML Diagram to write the get/set methods
public void setPlantType(boolean userIsAnnual)
{
isAnnual = userIsAnnual;
}
public boolean getPlantType() {
return isAnnual;
}
public void setColorOfFlowers(String userColorOfFlower) {
colorOfFlowers = userColorOfFlower;
}
public String getColorOfFlowers() {
return colorOfFlowers;
}
public void printInfo() {
System.out.println("Plant Information: ");
System.out.println(" Plant name: " + plantName);
System.out.println(" Cost: " + plantCost);
System.out.println(" Annual: " + isAnnual);
System.out.println(" Color of Flowers: " + colorOfFlowers);
System.out.println();
}
}