CRectangle

Download Category:

CRectangle.zip - (2.07 MB)
[
CRectangle/CRectangle.cpp
CRectangle/CRectangle.sdf
CRectangle/CRectangle.sln
CRectangle/CRectangle.suo
CRectangle/CRectangle.vcxproj
CRectangle/CRectangle.vcxproj.filters
CRectangle/CRectangle.vcxproj.user
CRectangle/Debug/
CRectangle/Debug/cl.command.1.tlog
CRectangle/Debug/CL.read.1.tlog
CRectangle/Debug/CL.write.1.tlog
CRectangle/Debug/CRectangle.exe
CRectangle/Debug/CRectangle.exe.embed.manifest
CRectangle/Debug/CRectangle.exe.embed.manifest.res
CRectangle/Debug/CRectangle.exe.intermediate.manifest
CRectangle/Debug/CRectangle.ilk
CRectangle/Debug/CRectangle.lastbuildstate
CRectangle/Debug/CRectangle.log
CRectangle/Debug/CRectangle.obj
CRectangle/Debug/CRectangle.pdb
CRectangle/Debug/CRectangle_manifest.rc
CRectangle/Debug/link.3236.read.1.tlog
CRectangle/Debug/link.3236.write.1.tlog
CRectangle/Debug/link.3236-cvtres.read.1.tlog
CRectangle/Debug/link.3236-cvtres.write.1.tlog
CRectangle/Debug/link.command.1.tlog
CRectangle/Debug/link.read.1.tlog
CRectangle/Debug/link.write.1.tlog
CRectangle/Debug/link-cvtres.read.1.tlog
CRectangle/Debug/link-cvtres.write.1.tlog
CRectangle/Debug/mt.command.1.tlog
CRectangle/Debug/mt.read.1.tlog
CRectangle/Debug/mt.write.1.tlog
CRectangle/Debug/rc.command.1.tlog
CRectangle/Debug/rc.read.1.tlog
CRectangle/Debug/rc.write.1.tlog
CRectangle/Debug/vc100.idb
CRectangle/Debug/vc100.pdb
CRectangle/ipch/
CRectangle/ipch/crectangle-9976d79e/
CRectangle/Question.txt
CRectangle/Screenshot.png
]

Define a class CRectangle to encapsulate length, width and related calculations according

to the UML diagram above. The getLength function returns the length and getWidth returns

the width. The setRect function prompts and gets input for the current object and the

showRect displays the data of the current object. The circumference function calculates the

circumference of the current object and returns it, and the area function calculates the

area and returns it. Function isLarger returns true if the area of the current object is

greater than the argument object.
Implement the member functions outside of class block to facilitate information

encapsulation. When display length, width, circumference and area, display with two

decimals.
Now exercise the class in client code. Besides test every single functions of the class,

also do the following:
1. Make an array of 10 CRectangle rectangles (i.e., objects).
2. Loop through the rectangles on the array to output the length and width of each

rectangle.
3. Loop through the rectangles to reset the length and width to the values user input.
4. Now display the length, width, the circumference, and the area of each of these

rectangles.
5. Sort the rectangles in descending order based on area.
6. Display the length, width, circumference, and area of these rectangles again to

verify they are sorted.
7. House clean the code, Good Bye message, and then end the program

Write a Review

Get a fresh solution of this question. Ask it now to our experts.
doubt

Ask Your Question

We have verified professionals who are ready to answer your question.

time

Save Time and Money

We choose experts who can quickly answer your question and that suit your budget.

download

Get Your Answer

Your satisfaction is 100% guaranteed. You can keep on asking questions until you get the answer you need.