SHARE
TWEET

Untitled

a guest Jun 23rd, 2013 281 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. public class Rectangle {
  2.    
  3.    private double length;//ERROR: illegal start of expression
  4.    private double width;
  5.  
  6.    /**
  7.     * Constructor
  8.     */
  9.  
  10.    public Rectangle(double len, double w)
  11.    {
  12.       length = len;
  13.       width = w;
  14.    }
  15.  
  16.    /**
  17.     * The setLength method accepts an argument
  18.     * that is stored in the length field.
  19.     */
  20.  
  21.    public void setLength(double len)
  22.    {
  23.       length = len;
  24.    }
  25.  
  26.    /**
  27.     * The setWidth method accepts an argument
  28.     * that is stored in the width field.
  29.     */
  30.  
  31.    public void setWidth(double w)
  32.    {
  33.       width = w;
  34.    }
  35.  
  36.    /**
  37.     * The set method accepts two arguments
  38.     * that are stored in the length and width
  39.     * fields.
  40.     */
  41.  
  42.    public void set(double len, double w)
  43.    {
  44.       length = len;
  45.       width = w;
  46.    }
  47.  
  48.    /**
  49.     * The getLength method returns the value
  50.     * stored in the length field.
  51.     */
  52.  
  53.    public double getLength()
  54.    {
  55.       return length;
  56.    }
  57.  
  58.    /**
  59.     * The getWidth method returns the value
  60.     * stored in the width field.
  61.     */
  62.  
  63.    public double getWidth()
  64.    {
  65.       return width;
  66.    }
  67.  
  68.    /**
  69.     * The getArea method returns the value of the
  70.     * length field times the width field.
  71.     */
  72.  
  73.    public double getArea()
  74.    {
  75.       return length * width;
  76.    }
  77.    
  78.    public static void main(String[] args){
  79.    }//end of: public static void main(String[] args)
  80.  
  81. }//end of: public class Rectangle  ERROR: class, interface, or enum expected
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top