Provide get methods to return value of each instance variables
public double getHeight(){
return height;
public double getWidth(){
return width;
Provide set methods that set instance variables to new values.
Public void setHeight(doubleHeight){
if (height <0 || height > 20){ throw new IllegalArgumentException("Height out of range");
Public void setWidth(doubleWidth){
if(width <0 || width > 20){ throw new IllegalArgumentException("Width out of range");
Provide a method to calculate perimeter
public double calculatePerimeter(){ return 2*(height + width);
Provide a method to calculate area
public double calculateArea(){ return height*width;
Create class RectangleTest
use main method Test for Invalid height try{ Rectangle r1 = new Rectangle(); r1.setHeight(24); r1.setWidth(10); print(CalculateArea); print(CalculatePerimeter) } catch(IllegalArgumentException e){ print(e.getMessage); }