Language Bar

Friday, January 28, 2011

CS201 Assignment 5 SOLUTION


Assignment No. 5
Semester: Fall 2010
CS201: Introduction to Programming
Total Marks: 20

Due Date: Jan 31st  ,2011

Instructions:
Please read the following instructions carefully before submitting your assignment:
It should be clear that your assignment will not get any credit if:

§         The assignment is submitted after due date.
§         The submitted assignment does not open or file is corrupt.

All types of plagiarism are strictly prohibited.

Note: You have to upload only .cpp file. Assignment in any other format (extension) will not be accepted. If you will submit code any other file format like .doc or .txt etc. you will get zero marks.

Objective
The objective of this assignment is to provide hands on experience of using

§         User defined manipulators
§         Static member
§         Copy Constructor

Guidelines
§         Code should be properly aligned and well commented.
§         Follow C/C++ rules while writing variables names, function names etc.
§         Use only Dev-C++ IDE for this assignment.

Assignment


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.


GOOD LUCK

Deadline:
Your Assignment solution must be submitted on or before Jan 31st, 2011.






---------------------------------------------------------------------------------------------------
Solution


/*YASIR JAVAED MC090200982*/

#include<iostream>
#include<conio.h>
#include<math.h>
using namespace std;

class CRectangle
{
      private:
              // Rectangle class is CRectangle. it is private nobody can make rectangle without its attributes.
              CRectangle()
              {
              }
      public:
              // Data members are
              int iBot;
              int iTop;
              int iLeft;
              int iRight;

              // Static variable to ensure rectangles calculate.
              static int rectCount;

              // Constructor of the class CRectangle.
              CRectangle(int bottom,int top,int left,int right)
              {
                          iBot = bottom;
                          iTop = top;
                          iLeft = left;
                          iRight = right;
                         
                          CRectangle::rectCount++;
              }

              // Dynamic Copy constructor of the class.
              CRectangle(const CRectangle& lhs)
              {
                          iBot = lhs.iBot;
                          iTop = lhs.iTop;
                          iLeft = lhs.iLeft;
                          iRight = lhs.iRight;
                         
                          CRectangle::rectCount++;
              }
             
              // Destructor of the class.
              ~CRectangle()
              {
                          CRectangle::rectCount--;
              }

              // Function to compute and obtain area of a rectangle.
              long Area()
              {
                   return(long)( abs(iTop-iBot) * abs(iLeft-iRight) );
              }
};


int CRectangle::rectCount=0;


int main ()
{
 
    CRectangle rect1 = CRectangle(0,80,0,80);
    CRectangle rect2 = CRectangle(0,70,0,80);
   
    cout<<"Area of rectangle 1 is "<<rect1. Area()<<endl;
    cout<<"\nArea of rectangle 2 is "<<rect2. Area()<<endl;
    cout<<"\nThe number of rectangles is "<<CRectangle::rectCount<<endl;

    {
         CRectangle rectCopied = CRectangle(rect1);
         cout<<"\nAfter using copy constructor, total number of rectangles is "<<CRectangle::rectCount<<endl;
    }

         
    cout<<"\nThe number of rectangles is "<<CRectangle::rectCount<<endl;

    getch();
    return 0;
}
 



                                  

CS615 GDB Solution


Total Marks 5
Starting Date Thursday, January 27, 2011
Closing Date Friday, January 28, 2011
Status Open
Question/Description

Graded Moderated Discussion Board (Graded MDB)
 Dear students a Graded Moderated Discussion Board will be opened for “Software Project Management (CS615)” from July 27, 2010 to July 28, 2010, in which you have to post your comments on the topic given below and it will have weight-age of 5% of your total subject marks. Your comments will be graded based on the logic you have used to support your answer.
“MONITORING AND CONTROLLING USING MEETINGS, REVIEWS AND REPORTS FOR COMMUNICATION WITH IN TEAM AND THE OUTSIDE WORLD IS BEst TECHNIQUE IN SOFWARE PROJECT MANAGEMENT” Either you agree or disagree with given statement , justify your reply with sound arguments”.
Note:
1.      Books, websites and other reading material may be consulted before posting your comments. (Do not copy the material as it is from net and other resources.) If any one found copying the answer of other students or from any web site will get zero marks for his/her attempt.
2.      Your comments must not exceed more than 7 lines.
3.      Try to come up with your own arguments so that you could get maximum benefit from this exercise.
4.      Short and to the point comments will be preferred over lengthy comments.
5.      You should post your comments on the Graded MDB & not on the Regular MDB. Both will run parallel to each other during the time specified above. Do not post multiple comments.
6.      Be careful for you may loose GMDB comments due to electricity load shedding and internet problems. You cannot participate in the discussion after the due date or through e-mail with in specified time.
7.      Your answer should contain important points. Also follow the instructions given in announcement.
You can start preparing your comments now.
In case of any query mail at CS615@vu.edu.pk


------------------------------------------------------


Solution



Monitoring and Controlling a project is the process or activities whereby the project manager tracks, reviews and revises the project activities in order to ensure the project creates the deliverables in accordance with the project objectives. Because of the unique and temporary nature of projects, they require active control. Unlike a process where the same set of activities have been performed repeatedly so that habits and expectations are stable, a project is inherently unstable. The activities are unique to the project or the sequence of activities and resources are only temporarily assigned associated with the project and are redeployed when the project completes. Habits and patterns are not established before everything changes.

The primary results of the Monitoring and Controlling processes are the project performance reports and implementing project changes. The focus for project management is the analysis of project performance to determine whether a change is needed in the plan for the remaining project activities. In my experience, almost every project will require a change to the plan at some point in time. Traditional projects are the most stable projects because the requirements and the activities are clear and well understood. Adaptive and Extreme projects are the least stable. They require very close control and will require numerous changes - if for no other reason the project manager will need to refine the activities of later phases based upon the results of early activities.
Tools and techniques that are used by project managers to conduct the Monitoring and Controlling of a project fall into one of four general categories. The first is the collection of project performance information. Techniques supporting this category are Pulse Meetings, Variance Reports, and Program Reviews. The second category is the analysis of the project performance to determine whether a project change is needed. Techniques that are used in this category are Project Forecasting and Problem Solving. The third category is reporting on project performance. Techniques that support this activity include the use of a Project Management Information System, Management Reviews, and Dashboards. The final category is the management of project change. The technique I commonly use in this category is the maintenance of a Change Management Log. There are two areas of project management tools and techniques that closely support the Monitoring and controlling process but are also used more broadly throughout the project lifecycle. These are important enough to justify their own page.
Program Reviews
Program Reviews are meetings with the project team members that review the current status of the project as compared to the original project plan. These are most often used on Full-scale and Complex projects. Unlike the Pulse Meetings which focus on day-to-day activities, the Program Reviews focus on the big picture and emphasize the integration between activities and between sub-projects encompassed within the project. The question being asked is whether the project activities and the sub-projects are likely to interfere with each other. In addition, when I have a supplier who is a major contributor on the project and is performing customized work on this project, I will conduct Program Reviews with the supplier for their portion of the project. Program Reviews are sometimes combined with Management Reviews. The danger with this approach is that key stakeholders and managers may intimidate some project team members from providing a frank and honest appraisal of status.

-----------------------------------------------------------------------------------------------

Monitoring and controlling a project is the system or activities. In it project manager record, analysis and modify the project activities in order to make sure project create in on time and according to the project objectives. The short term or temporary nature of projects they require active control because they create with different activities and requirements. in this type also required to communicate with the team and outside the world so to do required modification in software project In the other side long term or constant project where the same sets of activities execute frequently this type of project is much easier to handle because all the activities and requirements are constant and not required too much active control. In this type all the team members not necessary to communicate the each other and outside the world also.


    

CONTACT US FORM