Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Ball
- BEGIN
- Real x,y // Current position of the ball.
- Color color // The color of the ball.
- integer radius // The radius of the ball
- public Ball() // constructor
- BEGIN
- x = 100
- y = 100
- radius = 5
- color = ORANGE // set color to the colour ORANGE
- END
- public void draw()
- BEGIN
- // Draw the ball
- set colour for drawing to color
- drawFilledOval in bounding rectangle,
- top left (x, y), bottom right (x + 2*radius, Y + 2*radius)
- END
- public void setRadius(integer r)
- BEGIN
- radius = r
- END
- public integer getRadius()
- BEGIN
- return radius
- END
- public integer getX()
- BEGIN
- return (integer) x
- END
- public integer getY()
- BEGIN
- return (integer) y
- END
- public void setX(integer xIn)
- BEGIN
- x = xIn
- END
- public void setY(integer setY)
- BEGIN
- y = setY
- END
- END // end class Ball
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement