This week only. Pastebin PRO Accounts Christmas Special! Don't miss out!Want more features on Pastebin? Sign Up, it's FREE!
Guest

Untitled

By: a guest on Apr 27th, 2014  |  syntax: None  |  size: 1.02 KB  |  views: 36  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1.  
  2. public class Ball  
  3. BEGIN  
  4.    Real x,y      // Current position of the ball.
  5.    
  6.    Color color     // The color of the ball.
  7.  
  8.    integer  radius   // The radius of the ball
  9.  
  10.    public Ball() // constructor
  11.    BEGIN
  12.       x = 100
  13.       y = 100
  14.       radius = 5
  15.           color = ORANGE  // set color to the colour ORANGE
  16.    END
  17.    
  18.    public void draw()
  19.    BEGIN
  20.       // Draw the ball  
  21.       set colour for drawing to color
  22.       drawFilledOval in bounding rectangle,
  23.                 top left (x, y), bottom right (x + 2*radius, Y + 2*radius)
  24.    END
  25.    
  26.    public void setRadius(integer r)
  27.    BEGIN
  28.        radius = r
  29.    END
  30.    
  31.    public integer getRadius()
  32.    BEGIN
  33.        return radius
  34.    END
  35.    
  36.    public integer getX()
  37.    BEGIN
  38.         return (integer) x
  39.    END
  40.    
  41.    public integer getY()
  42.    BEGIN
  43.         return (integer) y
  44.    END
  45.    
  46.    public void setX(integer xIn)
  47.    BEGIN
  48.        x = xIn
  49.    END
  50.    
  51.    public void setY(integer setY)
  52.    BEGIN
  53.        y = setY
  54.    END
  55. END  // end class Ball
clone this paste RAW Paste Data