#include
using namespace std;
using namespace std;
class Computer{
private:
string Vendor;
string Cpu;
int Ram ;
int Hardisk ;
private:
string Vendor;
string Cpu;
int Ram ;
int Hardisk ;
public :
Computer();
Computer(string Vin ,string Cp,int rm,int hr) {
Computer();
Computer(string Vin ,string Cp,int rm,int hr) {
Vendor=Vin;
Cpu=Cp;
Ram=rm;
Hardisk=hr;}
void show(){
void show(){
cout /p>
//Memona Raza ID:BC150404237
#include <iostream>
using namespace std;
#include <iostream>
using namespace std;
class Computer{
private:
string Vendor;
string Cpu;
int Ram ;
int Hardisk ;
private:
string Vendor;
string Cpu;
int Ram ;
int Hardisk ;
public :
Computer();
Computer(string Vin ,string Cp,int rm,int hr) {
Computer();
Computer(string Vin ,string Cp,int rm,int hr) {
Vendor=Vin;
Cpu=Cp;
Ram=rm;
Hardisk=hr;}
void show(){
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;
Computer::Computer(){
Vendor;
Cpu;
Ram ;
Hardisk;
}
void Computer::setVendor(string Ven){
Ven= " :None";
Ven= " :None";
Vendor=Ven;
}
void Computer::setCpu(string cap){
cap = " :None";
Cpu= cap;
cap = " :None";
Cpu= cap;
}
void Computer::setRam(int r){
void Computer::setRam(int r){
r = 0 ;
Ram = r;
Ram = r;
}
void Computer::setHardisk(int h){
h = 0;
Hardisk = h;
void Computer::setHardisk(int h){
h = 0;
Hardisk = h;
}
string Computer::getVendor(){
return Vendor;
string Computer::getVendor(){
return Vendor;
}
string Computer::getCpu(){
return Cpu;
}
int Computer::getRam(){
return Ram;
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;
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();
Computer para(" Vendor : Intel"," CPU :i5",4, 500);
para.show();
return 0;
}
#include <iostream>
using namespace std;
using namespace std;
class Computer{
private:
string Vendor;
string Cpu;
int Ram ;
int Hardisk ;
private:
string Vendor;
string Cpu;
int Ram ;
int Hardisk ;
public :
Computer();
Computer(string Vin ,string Cp,int rm,int hr) {
Computer();
Computer(string Vin ,string Cp,int rm,int hr) {
Vendor=Vin;
Cpu=Cp;
Ram=rm;
Hardisk=hr;}
void show(){
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;
Computer::Computer(){
Vendor;
Cpu;
Ram ;
Hardisk;
}
void Computer::setVendor(string Ven){
Ven= " :None";
Ven= " :None";
Vendor=Ven;
}
void Computer::setCpu(string cap){
cap = " :None";
Cpu= cap;
cap = " :None";
Cpu= cap;
}
void Computer::setRam(int r){
void Computer::setRam(int r){
r = 0 ;
Ram = r;
Ram = r;
}
void Computer::setHardisk(int h){
h = 0;
Hardisk = h;
void Computer::setHardisk(int h){
h = 0;
Hardisk = h;
}
string Computer::getVendor(){
return Vendor;
string Computer::getVendor(){
return Vendor;
}
string Computer::getCpu(){
return Cpu;
}
int Computer::getRam(){
return Ram;
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;
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();
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;}