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: 8880

.

+ 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

Good Work :) Keep it Up 

es solution main functions ko main() se upar and class k bahar bnaya gya hai kia en functions ko class k andar define krdu koi problem tou nai marks tou nai katy gay????

better Keep the functions in public part of the class .

here the solution...

Attachments:

The program is written a bit tacky, plus you have to initialize default constructor variables.

& the message "________ Constructor called.." is not to be printed like that, it is to be displayed when the said constructor is called, i.e., it has to be written inside said constructor.

#include 
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 /p>

//Memona Raza ID:BC150404237
#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;

}

#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;

}

#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;

}




#include<iostream>
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"\nHRAD DISK : "pc1.getHDD();

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

cout"\nVendor : "pc2.getVendor();
cout"\nCPU : "pc2.getCPU();
cout"\nRAM : "pc2.getRam();
cout"\nHRAD DISK : "pc2.getHDD();
system("pause");

}

#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;

}

output rukti ku ni jaldi chali jati hai

RSS

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

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

.