VUsolutions Transferred to AchiKhasi.com
From December 2011, this blog www.VUsolutions.blogspot.com is transferred to http://achikhasi.com/vu/ . So, you may visit http://achikhasi.com/vu/ for latest study related help.
Back to home VUsolutions
VUsolutions Fans Club [join us for MORE solutions]
VUsolutions on Facebook
Important & Cool Links
Islamic Books in Urdu ! Beauty Tips in Urdu ! Online VU Lectures ! Unique Wallpapers ! Cooking Recipes - Urdu ! Women Kahani Ghar ! Health Tips in Urdu ! Showbiz Hidden Stories ! News Updates Online ! Bachon Ki Duniya ! Virtual University Study ! Prep to PhD Study Help ! Girls Women Block ! AIOU Study Block ! News & Politics Block ! Mix Plate Block - Others
Assignment No. 5
Semester: Fall 2010
CS201: Introduction to Programming
Total Marks: 20
Due Date: Jan 31st ,2011
Problem Statement:
You are required to write a program of class rectangle named CRectangle which should draw two rectangles by using iTop, iRight, iBot, and iLeft. Then program should calculate the area of both. Number of rectangles should be displayed to user by using static variable counter which would keep track of increment or decrement of rectangles. Dynamically Create another rectangle by using copy constructor and increment in counter should be displayed on screen. Decrement in static variable counter (after de-allocating memory which was dynamically allocated) should be displayed again on screen.
Sample Output
Area of rectangle 1 is 6400
Area of rectangle 2 is 5600
The number of rectangles is 2
After using copy constructor, total number of rectangles is 3
The number of rectangles is 2
Detailed Description:
1. The class should have 4 members: iTop, iRight, iBot, and iLeft, all of type int.
2. Area of both rectangles should be calculated by using iTop, iRight, iBot, and iLeft.
3. It should have a default constructor and a copy constructor.
4. It should have a destructor.
5. It should contain all required getters and setters.
6. It should contain a static member, iRefCount, which keeps track of the number of CRectangle objects. Increment it in the constructor, and decrement it in the destructor.
Hint:
CRectangle would implement rectangles by using left, right, top and bottom and calculate their areas to compare.
Back to home VUsolutions
Shaadi.com: Just create ur account & find ur partner or EARN money, its reall & EASY
VUsolutions Followers (Join NOW and Get Extra Benefits)
VU related Blogs
Install LATEST toolbar having lot of features - GET solutions on Desktop
toolbar powered by Conduit |