Question: Create a class named Rectangle. This class should contain at minimum: fields for length and width setters and getters for the fields a constructor that

 Create a class named Rectangle. This class should contain at minimum:

Create a class named Rectangle. This class should contain at minimum: fields for length and width setters and getters for the fields a constructor that accepts length and width as parameters an overloaded O-arg constructor that sets field values to 0 a method named compute Area that accepts no parameters and returns the area Create a class named Circle. This class should contain at minimum: a field for radius setters and getters for the field(s) a constructor that accepts radius as a parameter an overloaded O-arg constructor that sets field values to 0 a method named compute Area that accepts no parameters and returns the area In a separate class, write an application to neatly output, with descriptive text: the area of two rectangles having sides (4, 5) and (5.7, 8.1) respectively o use each Rectangle constructor once the area of two circles having radius 4.2 and 3 respectively o use each Circle constructor once Your output must display your shapes' dimensions and areas. Do not hard-code any values into your output statements. Example output: Rectangle with sides 4.0 and 5.0 has area 20.0 Rectangle with sides 5.7 and 8.1 has area 46.17 Circle with radius 4.2 has area 55.41769440932395 Circle with radius 3.0 has area 28.274333882308138

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!