Question: create a public class Rectangle.java with integer variables height and width. Write down the default and the custom constructor. Then write down the getters methods

create a public class Rectangle.java with integer variables height and width. Write down the default and the custom constructor. Then write down the getters methods for the height, width, and area of the rectangle. Then, write down the setters for the height and width. Finally, write a toString() method to print the height, width, and area of the rectangle. Consult the test cases provided in API and RectTester.java to figure out the correct names of the getter and setter methods.

  • public class Rectangle extends java.lang.Object

API:

create a public class Rectangle.java with integer variables height and width. Write

down the default and the custom constructor. Then write down the getters

getH public int getH() getw public int getw() getA public int geta () setH public void seti(int h) setw public void setw(int w) to String public java.lang.String toString() Overrides: toString in class java.lang. Object

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 Databases Questions!