Write a Rectangle class which has data members, height and width. The class shou
ID: 3560750 • Letter: W
Question
Write a Rectangle class which has data members, height and width. The class should have methods getHeight, getWidth and getArea. Two rectangles are equal if their areas are the same. Write the class using equals() method.
Write a main function, which creates two instances of rectangle and checks if the two rectangles are equal.
For e.g
Rectangle r1 = new Rectangle(3,5)
Rectangle r2 = new Rectangle(3,5)
System.out.println(r1.equals(r2));
Your program should not throw error for the below usage:
Rectangle r1 = new Rectangle(3,5);
String s =
Explanation / Answer
/* This application will calculate the input numbers prompted from a user for Rectangle and square sides to its
002 * area, and perimeters that will be printed out together with the with the length and width.Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.