StaticMethodsRectangleIntro
public class RectangleV0 {
public static intfindArea(int length, int width) {
return length * width;
}
public static void main(String args[]) {
/** Write a line of code to find and print the
* area of a rectangle with length x and width y
*/
int x = 2;
int y = 5;
______
}
}
------
public class RectangleV1
{
public static intfindArea(int length, int width) {
return length * width;
}
}
public class RectangleV1Tester {
public static void main(String args[]) {
/** Write a line of code to find and print the
* area of a rectangle with length x and width y
*/
int x = 2;
int y = 5;
______
}
}
public class RectangleV2
{
private int length;
private int width;
public RectangleV2(intlen, intwid) {
length = len;
width = wid;
}
public intfindArea() {
return length * width;
}
public static void main(String args[]) {
/** Write code to find and print the
* area of a rectangle with length x and width y
*/
int x = 2;
int y = 5;
______
______
______
}
}
public class RectangleV3
{
private int length;
private int width;
private static intmaxArea;
public RectangleV3(intlen, intwid) {
length = len;
width = wid;
if (findArea() > maxArea)
maxArea = findArea();
}
public intfindArea() {
return length * width;
}
public static intgetMaxArea() {
return maxArea;
}
public static void main(String args[]) {
RectangleV3 r1 = new RectangleV3(3,4);
RectangleV3 r2 = new RectangleV3(2,5);
/** Write a line of code to find and print the
* area of a rectangle r1
*/
______
/** Write a line of code to find and print the
* area of a rectangle r2
*/
______
/** Write a line of code to find and print the
* maximum area of all rectangle objects created
*/
______
}
}