We are here with you hands in hands to facilitate your learning & don't appreciate the idea of copying or replicating solutions. Read More>>

Looking For Something at vustudents.ning.com? Click Here to Search

www.bit.ly/vucodes

+ Link For Assignments, GDBs & Online Quizzes Solution

www.bit.ly/papersvu

+ Link For Past Papers, Solved MCQs, Short Notes & More


Dear Students! Share your Assignments / GDBs / Quizzes files as you receive in your LMS, So it can be discussed/solved timely. Add Discussion

How to Add New Discussion in Study Group ? Step By Step Guide Click Here.

Correct and Final Solution of Assignment No.3 Of CS201 Due Date 14 Jan 2013 Solved by Waqas Rasheed

+ How to Follow the New Added Discussions at Your Mail Address?

+ How to Join Subject Study Groups & Get Helping Material?

+ How to become Top Reputation, Angels, Intellectual, Featured Members & Moderators?

+ VU Students Reserves The Right to Delete Your Profile, If?


See Your Saved Posts Timeline

Views: 4136

.

+ http://bit.ly/vucodes (Link for Assignments, GDBs & Online Quizzes Solution)

+ http://bit.ly/papersvu (Link for Past Papers, Solved MCQs, Short Notes & More)

+ Click Here to Search (Looking For something at vustudents.ning.com?)

+ Click Here To Join (Our facebook study Group)

Replies to This Discussion

bro will u please upload .cpp file?

No. ap khud lilkhoo. theek likhoo compile na hoto mai zimmadaar hon

jo loog solution ko ghalaat bata rahe hien .. after deadline mai ccp file b de do ga.. phr chck kar lena.. solution theek tha ya nahi..ya ap sirf ap ke mistake the

yar end kese krna hai

yeh lo aur mooj maro 

Attachments:

This is wrong solution...

Correct solution is this

check it geys.. just run it on devc++

Attachments:

Rao Usman

its a wrong solution becasuse of you did not dynamaclly allocate the memory..

my solution is 100% correct

using namespace std;

#include<iostream>

#include<conio.h>

class Vehicle{
      private:string company;
              string model;
              double year;
              double engineCapacity;
              public:
              void setCompany(string cmp)
              {company = cmp;
                   }
              string getCompany()
              {
                     return company;
                     }
              void setModel(string md)
              {
                   model = md;
                   }
              string getModel()
              {
                     return model;
                     }
              void setYear(double yr)
              {
                   year = yr;
               }
               double getYear()
               {
                return year;      
                      }
                void setEngineCap(double eCap)
                {
                     engineCapacity = eCap;
                     }
                double getEngineCap()
                {
                       return engineCapacity;
                 }

Vehicle *ptr;
      int numVehicle;
      void getInput()
      {cout"Enter number of vehicle:";
           cin>>numVehicle;
           ptr = new Vehicle[numVehicle];
           for(int i=0;i<numVehicle;i++)
           {string Cmp;
                   cout"\n\nVehicle "i+1endl;
                   cout"Enter the name of Vehicle maker company :";
                   cin>>Cmp;
                   ptr[i].setCompany(Cmp);
                   string md;
                   cout"Enter Vehicle model :";
                   cin>>md;
                   ptr[i].setModel(md);
                   double rg;
                   cout"Enter year of registration:";
                   cin>>rg;
                   ptr[i].setYear(rg);
                   double egC;
                   cout"Enter engine of thr Vehicle:";
                   cin>>egC;
                   ptr[i].setEngineCap(egC);
                   }

}
void display()
{ for(int i=0;i<numVehicle;i++)
     {
      cout"\n\n\nVehicle"i+1endl;
      cout"\nCompany :"ptr[i].getCompany()endl;
      cout"\nModel: "ptr[i].getModel()endl;
      cout"\nYear:"ptr[i].getYear()endl;
      cout"\nEngine Capacity in CC:"ptr[i].getEngineCap()endl;
      }
      }

Vehicle()
      {
               company = "ABC";
               model = "xyz";
               year = 2009;
               engineCapacity = 1000;
               }
      ~Vehicle()
      { cout"\nObject deleted\n";
                 }
                 };
                 int main()
                 {
                     Vehicle obj;
                     obj.getInput();
                     obj.display();
                     delete[] obj.ptr;
                     getch();
                     }                 
                        //by Emran Haakim

RSS

© 2019   Created by + M.Tariq Malik.   Powered by

Promote Us  |  Report an Issue  |  Privacy Policy  |  Terms of Service

.