Question: (question 20.) Create a class header and source files for class Rectangle with attributes length and width, each of which defaults to 1. Provide member

(question 20.) "Create a class header and source files for class Rectangle with attributes length and width, each of which defaults to 1. Provide member functions that calculate the perimeter and the area of the rectangle. Create two constructors 1, the default constructor, and 2 , a constructor that accepts the length and width as inputs. Include the necessary getter and setter functions. The setter functions should verify that length and width are floating-point numbers larger than 0.0 and less than 20.0."

(question 21) Write a main program that uses the class you defined in problem 20. Your main program should accept the length and width of a rectangle, instantiate a rectangle object and print out the perimeter and area of the rectangle.

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!