Write program that uses a class named rectangle the class


Program: Write program that uses a class named Rectangle. The class has floating point attributes length and width. it has member functions that calculate the perimeter and area of the rectangle. It also has set and get functions for both length and width.

The set functions verify that length and width are each floating-point numbers larger than 0.0 and less than or equal to 20.0.

 if invalid length or width are given, then length and width will be set to 1.0. A "predicate function" will determine if the rectangle is a square. (A square exists if the length and width differ by less than .0001).

The class will have a destructor that displays a message indicating that an object has "gone out of scope".

Part 1: The class will have 3 overloaded contractor functions. The first will have no parameters (In this function set the length and width to 1.0 in the body of the function.)

The second will have one parameter (length). (in this function set the width to 1.0 in the body of the function.) The third will have two parameters (length and width).

This third contractor will set length and width to 1.0 in the body of the function if the values for these members are invalid.

Part 2: error messages will indicate that an attempt has been made to create an object with invalid parameters.

Part 3: A header file will be used to declare the class. Other header files may be used if you wish. A separate .cpp file will be used to implement the class member functions. Hence, your program will consist of at least one header file and at least 2 .cpp files

You need to make well-formed and clean code and add comments in code section that will be useful in the future.

Request for Solution File

Ask an Expert for Answer!!
JAVA Programming: Write program that uses a class named rectangle the class
Reference No:- TGS0949877

Expected delivery within 24 Hours