Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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:
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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started