Question: i . Modify the dimension attributes of the Rectangle class to properly handle the double datatype instead of simple integers. ii . Modify the Rectangle

i. Modify the dimension attributes of the Rectangle class to properly handle the double datatype instead of simple integers.
ii. Modify the Rectangle class to permit construction of rectangles using zero input arguments (in which case both height and width are set to 1) or one input argument (in which case the height is set to the input value, and the width is set to be 1). Hint: you will need to employ overloading.
iii. Modify the Rectangle class to have method double PrintMaxSide(), which returns (not prints!) the largest available dimension between the height and width (i.e. if the height is larger, it should be returned, if the width is larger, it should be returned instead.)
iv. Modify the Rectangle class to have method void IsValid() which either i. prints "This is a valid rectangle." If height and width are both positive or ii. prints "This is not a valid rectangle." if either height or width is 0 or negative.
Note: parts iii and iv will almost certainly require if statements.
 i. Modify the dimension attributes of the Rectangle class to properly

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!