Question: Design a Rectangle class (Rectangle.java) that has fields length, width and area. Write the appropriate accessor and mutator methods, and a constructor that accepts the
Design a Rectangle class (Rectangle.java) that has fields length, width and area. Write the appropriate accessor and mutator methods, and a constructor that accepts the length, width as arguments. The class should also have a method that returns the area of a rectangle, which is calculated as the length multiplied by the width. Write a program (RectangleDemo.java) that demonstrates the class by creating a Rectangle objects (box1, box2 and box3), and then ask the user to enter the data for each rectangle. The program should display the area for each rectangle.
1. Rectangle.java
2. Rectangle Demo.java
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
