Question Lab W3
Question Lab W3
Rectangle
-width : double
-height : double
+Rectangle()
+Rectangle(double,double)
+setWidth(double)
+setHeight(double)
+getArea():double
+getPerimeter(): double
coding
public Rectangle(){}
width = widthN;
length = lengthN;
width = widthN;
length = lengthN;
}
public double getWidth(){
return width;
return length;
return perimeter;
return area;
---------------------------------------------------------------------------
-------------------------------------------
System.out.println(obj1);
System.out.println(obj2));
}
QUESTION 2
coding
public Length() {
this.cm = 0.0;
this.cm = cm;
return cm;
return cm * 0.393701;
return cm / 100;
return cm * 0.0328084;
return "Length(cm): " + cm + ", Inch: " + getInch() + ", Meter: " +
getMeter() + ", Feet: " + getFeet();