Question: Please write in java, just java please In this assignment you are going to create a Rectangle class to perform certain operations that are relevant
Please write in java, just java please
In this assignment you are going to create a Rectangle class to perform certain operations that are relevant to rectangles. Also, you will create a RectangleTest class to demonstrate its functionality. Rectangle class should have length and width parameters to account for two sides. Area is not an instance variable; it is something that can be calculated once the user calls getAreal). The methods you should have: . Rectangle() //default constructor that sets O to both length and width Rectangle(int, int) //constructor that initializes both variables. toString() //returns a string to display rectangle information . isSquarel) //method to check if length equals width. If it is, returns true. .getArea() // Returns length x width You should create 3 rectangles in your system. Then use toString method to display the rectangle information. A sample code block in the main should look something like (for 1 rectangle): Rectangle rl = new Rectangle(10,10); System.out.println(rl); //don't forget, this call means return the string coming from rl.toString(). And this should display something like***. A new object defined. Length: 10 Width: 10 This object is a square. ***So arrange your toString() method accordingly
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
