import java.awt.*; // use graphics public class SmallStar extends Sprite { int x; //(x,y) is the initial position for the center of the star int y; int radius; int appearTime; //frame number when the star will appear on screen Randomizer r; //to produce random numbers. // add more instance variables if needed int frameNumber; public SmallStar() { r = new Randomizer(); frameNumber = 0; } public void drawState(Graphics g) { // if the star has not appeared yet, do nothing // otherwise draw the star, using x,y, and radius // add your code here if (frameNumber > appearTime) { //if star has already appeared... //draw it g.setColor(Color.white); g.fillOval(x-radius, y+radius, 2*radius, 2*radius); } } public void updateState() { // add your code here frameNumber = frameNumber + 1; } public void resetState() { // generate random parameters x = r.IntBetween(0, width); y = r.IntBetween(0, height); radius = r.IntBetween(1, 5); appearTime = r.IntBetween(1, 100); // add more code here if needed } // For debugging: public String className() { return "SmallStar"; } public String toString() { return className() + "[" + "x=" + x + "; y=" + y + "; radius=" + radius + "; appearTime=" + appearTime + "]"; } }