Lab #4 Solution

$30.00 $24.90

Description

Objectives:
The objective of this lab is to help you better understand how to write C++ programs that contain your own class definitions.

After completing this lab, you should be able to write a program in C++ that contains your own class definition, and that creates and uses objects of that class.

In this program you will create your own Rectangle class. The class diagram for the Rectangle class is shown here. Because Visual C++ has its own Rectangle class, you will have to give your class a different name, such as MyRectangle.

Your program should work as follows:

It should create an object of your rectangle class. Use a height of 4 and a width of 7 in the constructor.
Using getHeight and getWidth, display the size of the rectangle represented by your Rectangle object.
Using the getArea function, display the area of the rectangle object.
Note:For the sake of brevity, file and function prologues have not been included in the example code shown here. When you submit your project, be sure that you have complete function prologues for every function in your Rectangle class.
For classes, function prologues belong in the header file for the class. Also be sure that every source code file that you submit has a file prologue.

After you are satisfied that your program works correctly, place the following files into a zip folder and submit it to Canvas as Lab #3.

The file containing your main( ) function
The .h and .cpp files for your Rectangle class
lab03.exe

Grading:
o All source code files contain a complete file prologue
o Source code files contain declaration that you did not copy code
o Project has been properly submitted to Canvas
o Code meets style guidelines
o The program works correctly.