|
-
Aug 31st, 2005, 04:54 PM
#1
Thread Starter
New Member
Can anyone help me finish my code for cash ? :P
Can anyone help me with this task ?
Implement a subclass Square that extends the Rectangle class. In the constructor, accept the the x- and y- coordinates of the centre and the siude length of the square. call the setLocation and setSize methods of the rectangle class (look these up !!) Also supply a method getArea that returns the area of the square. Write a test class that makes use of the square class.
So far I have this:
public class Square
{
private int length;
Square (int l) {
this.length =l;
}
public void setLength(int l)
{
this.length =l;
}
}
public int getArea() {
return this.length*this.length;
How do i finish it off ?
Theres a drink via Paypal in it for ya !!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|