Question: Below, there's always a unit test failure. Type the program's output CallRectangle.java public class CallRectangle { public static void main ( String [ ] args

Below, there's always a unit test failure. Type the program's output
CallRectangle.java
public class CallRectangle { public static void main(String[] args){ Rectangle myRectangle = new Rectangle(); myRectangle.setSize(1,4); if (myRectangle.getArea()!=4){ System.out.println("FAILED getArea() for 1,4"); } if (myRectangle.getPerimeter()!=10){ System.out.println("FAILED getPerimeter() for 1,4"); } myRectangle.setSize(2,6); if (myRectangle.getArea()!=12){ System.out.println("FAILED getArea() for 2,6"); } if (myRectangle.getPerimeter()!=16){ System.out.println("FAILED getPerimeter() for 2,6"); }}}
Rectangle.java
public class Rectangle { private int height; private int width; public void setSize(int heightVal, int widthVal){ height = heightVal; width = heightVal; } public int getArea(){ return height * width; } public int getPerimeter(){ return (height *2)+(width *2); }}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!