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.

Dear Student Please discus here about this Assignment :) . Thanks

+ 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: 8881

.

+ 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

jo program is tarha kary return 0; say pahly   system("pause"); laga do  

 system("pause"); lagane se error de raha hai ka

system is not defined in this scope

errors aa rahian hain es main. Kiya code sy phele koi directory lagani hai??

koe btaye ga output rukti ku ni jaldi se chali jati hai????

@Fiinder system("pause"); add kro code k end pr output ruk jaye gi. 

 system("pause"); lagane se error de raha hai ka

system is not defined in this scope

 

/*
Assignment No : 3
VU-ID:
Name:
Date: 19/01/16 17:31
*/

#include<iostream>
#include <cstring>
using namespace std;

class Computer
{
private :
string Vendor;
string CPU;
int Hard_Disk;
int Ram;
public :
// setter functions
void setVendor(string vndr)
{
this->Vendor = vndr;
}
void setCPU(string cpu)
{
this->CPU = cpu;
}
void setHDD(int hdd)
{
this->Hard_Disk = hdd;
}
void setRam(int ram)
{
this->Ram = ram;
}
// getter funstions
string getVendor()
{
return Vendor;
}
string getCPU()
{
return CPU;
}
int getHDD()
{
return Hard_Disk;
}
int getRam()
{
return Ram;
}
// Default constructor
Computer()
{
cout"\n\nDefault constructor called....\n";
Vendor = "None";
CPU = "None";
Hard_Disk = 0;
Ram = 0;
}
// parameterized constructor
Computer(string vndr, string cpu, int ram, int hdd)
{
cout"\n\nParameterized constructor called....\n";
setVendor(vndr);
setCPU(cpu);
setHDD(hdd);
setRam(ram);
}
};
main()
{
Computer pc1;
cout"\nVendor : "pc1.getVendor();
cout"\nCPU : "pc1.getCPU();
cout"\nRAM : "pc1.getRam();
cout"\nHard Disk : "pc1.getHDD();

Computer pc2("Intel", "i5", 4, 500);

cout"\nVendor : "pc2.getVendor();
cout"\nCPU : "pc2.getCPU();
cout"\nRAM : "pc2.getRam();
cout"\nHard Disk : "pc2.getHDD();
coutendl;
cout"--------------------------------- "endl;

system ("pause");
return 0;
}

cs201 solution 2016

#include <iostream>
using namespace std;

class Computer{
private:
string Vendor;
string Cpu;
int Ram ;
int Hardisk ;



public :
Computer();
Computer(string Vin ,string Cp,int rm,int hr) {



Vendor=Vin;

Cpu=Cp;

Ram=rm;

Hardisk=hr;}
void show(){

cout Vendor" "endlCpu " "endl "Ram : " Ram" "endl"Hard Disk : "Hardisk" "endl;


};


void setVendor(string);
void setCpu(string);
void setRam(int);
void setHardisk(int);
string getVendor();
string getCpu();
int getRam();
int getHardisk();

};
Computer::Computer(){
Vendor;
Cpu;
Ram ;
Hardisk;


}

void Computer::setVendor(string Ven){
Ven= " :None";

Vendor=Ven;



}

void Computer::setCpu(string cap){
cap = " :None";
Cpu= cap;

}
void Computer::setRam(int r){

r = 0 ;
Ram = r;

}
void Computer::setHardisk(int h){
h = 0;
Hardisk = h;

}
string Computer::getVendor(){
return Vendor;

}

string Computer::getCpu(){
return Cpu;
}
int Computer::getRam(){
return Ram;


}
int Computer::getHardisk(){
return Hardisk;
}


int main(){

Computer sys ;
string Vin;
string Cp;
int rm;
int hr;
sys.setVendor(Vin);
sys.setCpu(Cp);
sys.setRam(rm);
sys.setHardisk(hr);
cout "The default Constructor is called....."endl;
cout "Vendor:"sys.getVendor()endl;
cout " Cpu: "sys.getCpu()endl;
cout "Ram:"sys.getRam()endl;
cout "Hard disk:" sys.getHardisk()endl;
cout endl;

cout "The parameterized Constructor is called......" endlendl;
Computer para(" Vendor : Intel"," CPU :i5",4, 500);
para.show();

return 0;

}

 CS201 Assignment 3(Solution)

  • First of all create class with the name of computer with following code:


         class computer{

          }

  • inside the class define 2 sections as private and public with following code:


        public: // for the public variables.
        void setModel(string s);
        string getModel();

         void setRamMemory(int i);
         int getRamMemory();
        
         computer();// define constructor without parameters
         computer(string, int);// define constructor with parameters
       
          private: // for the private variables.

          string Model;
          int RamMemory;

  • After this close the class and your code should look like this 

 




















  • Now start working on defined functions above" let us start with default values for the constructor without parameters..



computer::computer(){
Model="None";
RamMemory=0;
}

  • Now define the constructor's objects with values with following way:

computer::computer(string Model,int RamMemory){
setModel(Model);
setRamMemory(RamMemory);
}

  • After doing this start writing SETTER function's code with following way:

void computer::setModel(string s){
 Model=s;
}
void computer::setRamMemory(int i){
 RamMemory=i;
}

  • Same like this now write the code for GETTER functions defined above with following code:



string computer::getModel(){
return Model;
}
string computer::getRamMemory(){
return RamMemory;
}

  • Now come to the final point with displaying values in program with the following way:


int main()
 {
 
  cout "computer without paramerters" endl;
       //initialize the constructor and display
  computer comp1; cout"Model == " comp1.getModel() endl;

cout"RAM Memory == " comp1.getRamMemory() endl;
cout "computer with paramerters" endl;
computer comp2("IBM",5);
cout"Model == "comp2.getModel() endl;
cout"RAM Memory == " comp2.getRamMemory() endl;

  return 0;
 }

RSS

Latest Activity

+ M.Tariq Malik liked + M.Tariq Malik's discussion Mid Term Past Papers Made By WAQAR & Solved By HADI
23 seconds ago
+ M.Tariq Malik's 5 discussions were featured
24 seconds ago
+ M.Tariq Malik posted discussions
59 seconds ago
+ ! ! ! ! ! ! ! ! ! ! ! ! ! replied to Alishba's discussion Nikkah Mubarak To <3 !! 'JS' !! <3
13 minutes ago
MIRZA UMER BAIG liked Saniya Shahbaz's profile
16 minutes ago
MIRZA UMER BAIG left a comment for Saniya Shahbaz
16 minutes ago
Charming HaDi liked ++PrInCeSss++'s profile
24 minutes ago
hareem mughal posted a photo
29 minutes ago
+ " J ɨ y α •" ⋆ replied to + " J ɨ y α •" ⋆'s discussion Let's celebrate the Birthday of our Beloved Mod + "αяsαℓ " Ќąƶµяɨ •"
29 minutes ago
khaaniii posted a photo
29 minutes ago
+¢αяєℓєѕѕ gιяℓ liked Alishba's discussion Nikkah Mubarak To <3 !! 'JS' !! <3
30 minutes ago
+¢αяєℓєѕѕ gιяℓ replied to Alishba's discussion Nikkah Mubarak To <3 !! 'JS' !! <3
30 minutes ago

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

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

.