Question: by basic java Project Name: _LAB01_Rectangle Write a JAVA class, called Rectangle, that has two properties: width and length. This class has two constructers. The

 by basic java Project Name: _LAB01_Rectangle Write a JAVA class, called

by basic java

Project Name: _LAB01_Rectangle Write a JAVA class, called Rectangle, that has two properties: width and length. This class has two constructers. The first constructor takes no argument, and the constructer sets the width to 1 and sets the length to 1. The second constructor takes two arguments that set those two properties. This class has five methods, as follows. 1 double findArea (): it computes and returns the area of the rectangle. 2. double findPerimeter(): it computes and returns the perimeter of the rectangle. 3. double findDiagonal (): it computes and returns the diagonal of the rectangle. 4. boolean isSquare(): it returns true if the rectangle is a square; otherwise, false. 5. void printBasicInfo(): it prints the following two lines. The width is [width]. b. The length is [length). a. Note: [property] means the value of the property. For example, [width] means the value of the property named width. W9 Exercise 2 (2 points) Project Name: _LABO1_Rectangle Write a JAVA class, called TestRectangle, that tests the Rectangle. It has only the main method. In the main method, do the following. 1. Use the keyword new to create an object of Rectangle with the no-argument constructor and name this object box1. 2. Print the basic information of box1. 3. Print the perimeter of box1. 4. Print the diagonal of box1. 5. If boxl is a square box, print "It is a square box." Otherwise, print "It is not a square box." 6. Repeat 1-5 with another object that is created with another constructor. You may name this object box2

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!