import SimKit.*;
public class Ball extends SimKit.Event {
public static final int GREEN = 1, RED = 2;
public int color; public int stepsCounter;
public Ball (int c) {
color = c;
stepsCounter = 0 ;
}
public boolean isGreen() {
return(color == GREEN);
}
public boolean isRed() {
return(color == RED);
}
public String toString() {
String str = super.toString();
if (color == GREEN) { str+= "Green "; }
else { str += "Red "; }
str += " \tStepsCounter = "+stepsCounter;
return(str);
}
}
LP
LP
LP
. . .
Previous slide | Next slide | Back to first slide | View graphic version |