Question: Write the following class: A rectangle class that has fields to represent the width and height (as doubles). The class should have methods to: set
Write the following class:
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.
Instructions: Code must be in Java with comments explaining what you did.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
