akosiraff

CRectangle C++

May 12th, 2013
178
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.54 KB | None | 0 0
  1.  
  2. Download: http://solutionzip.com/downloads/crectangle-cpp/
  3. Define a class CRectangle to encapsulate length, width and related calculations according
  4. to the UML diagram above. The getLength function returns the length and getWidth returns
  5. the width. The setRect function prompts and gets input for the current object and the
  6. showRect displays the data of the current object. The circumference function calculates the
  7. circumference of the current object and returns it, and the area function calculates the
  8. area and returns it. Function isLarger returns true if the area of the current object is
  9. greater than the argument object.
  10. Implement the member functions outside of class block to facilitate information
  11. encapsulation. When display length, width, circumference and area, display with two
  12. decimals.
  13. Now exercise the class in client code. Besides test every single functions of the class,
  14. also do the following:
  15. 1. Make an array of 10 CRectangle rectangles (i.e., objects).
  16. 2. Loop through the rectangles on the array to output the length and width of each
  17. rectangle.
  18. 3. Loop through the rectangles to reset the length and width to the values user input.
  19. 4. Now display the length, width, the circumference, and the area of each of these
  20. rectangles.
  21. 5. Sort the rectangles in descending order based on area.
  22. 6. Display the length, width, circumference, and area of these rectangles again to
  23. verify they are sorted.
  24. 7. House clean the code, Good Bye message, and then end the program
  25.  
  26. Download: http://solutionzip.com/downloads/crectangle-cpp/
Advertisement
Add Comment
Please, Sign In to add comment