package daisy; import wheels.users.*; public class Daisy { protected ConversationBubble bubble; protected byte numPetalsPlucked; protected Ellipse center = new Ellipse(java.awt.Color.yellow); protected Rectangle stem = new Rectangle(java.awt.Color.green); public Daisy(int x, int y, ConversationBubble bubble) { this.bubble = bubble; stem.setSize(10, 100); stem.setLocation(x + 15, y + 40); numPetalsPlucked = 0; new Petal(x - 20, y - 30, this); new Petal(x, y - 30, this); new Petal(x + 20, y - 30, this); new Petal(x - 30, y, this); new Petal(x + 30, y, this); new Petal(x - 30, y + 25, this); new Petal(x - 10, y + 30, this); new Petal(x + 10, y + 30, this); new Petal(x + 30, y + 25, this); center.setSize(40, 40); center.setLocation(x, y); } public void petalPlucked() {//final version with ternery operator numPetalsPlucked++; bubble.setText("Loves me" + (numPetalsPlucked < 9 ? " not." : ".")); } public void petalPluckedOriginalVersion () { numPetalsPlucked++; if (numPetalsPlucked < 9) { bubble.setText("Loves me not."); } else { bubble.setText("Loves me."); } } public void petalPluckedTextVersion() { numPetalsPlucked++; String text = null; if (numPetalsPlucked < 9) { text = "Loves me not."; } else { text = "Loves me."; } bubble.setText(text); } }