Question: Write a circle class that has a field to represent the radius (as a double). The class should have a method to set the radius

Write a circle class that has a field to represent the radius (as a double). The class should have a method to set the radius and get the radius. The class should have an empty constructor to initialize the radius to 1, and a non-empty constructor to initialize the radius to a given value. The class should be encapsulated.

Write a rectangle class that has fields to represent the width and height (as doubles). The class should have methods to: set the height, get the height, set the width, get the width, and a method to set both the width and height. The class should have a non-empty constructor to initialize the fields to given values. The class should be encapsulated.

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!