-
February 1st, 2009, 02:48 PM
#1
Creating a Oval class?
hey I got to create an oval class for my java class.
Create an Oval class given the following design:
YourLastNameOval
variables: width, length
methods:
setWidth - changes the width. Requires one parameter for width.
setLength - changes the length. Requires one parameter for length.
getWidth - returns the oval width.
getLength - returns the oval length.
area - returns the area of the oval ((l*w)*0.8) given the current width and length
Write appropriate client code to test the class. Call the client class simply YourLastName
This is what I have so far.
public class McIntoshOval {
public double length, width;
public Oval(){
public int width = 5;
public int length = 10;
}
public Oval(double l, double w){
length = l;
width = w;
}
public void setLength(){
length = l;
}
public double getLength(){
return(length);
}
public void setWidth(){
width = w;
}
public double getWidth(){
return(width);
}
public double area (){
return((l*w)*0.8) ;
}
public static void main(String[] args) {
}
}
Can anyone give me some help, perhaps stir me in the right direction and let me know of things I am missing Id really appreciate it. Thanks.
And client code?? What is that?
Tags for this Thread
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
|