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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started