Академический Документы
Профессиональный Документы
Культура Документы
============================================
#include <stdlib.h>
#include <string.h>
#include <iostream.h>
class Hdd{
public:
Hdd(){}
Hdd(int hCap)
{
hddCapacity=hCap;
}
int getHddCapacity()
{
return hddCapacity;
}
private:
int hddCapacity;
};
class Ram{
public:
Ram(){}
Ram(int rCap)
{
ramCapacity=rCap;
}
int getRamCapacity()
{
return ramCapacity;
}
private:
int ramCapacity;
};
class Processor{
public:
Processor(){}
Processor(int s)
{
clockSpeed=s;
}
void setProcessorSpeed(int s)
{
clockSpeed=s;
}
int getProcessorSpeed()
{
return clockSpeed;
}
private:
int clockSpeed;
};
class Mouse{
public:
Mouse(){}
Mouse(char *mTyp)
{
strcpy(mouseType,mTyp);
}
void setMouseType(char *mTyp)
{
strcpy(mouseType,mTyp);
}
char *getMouseType()
{
return mouseType;
}
private:
char mouseType[20];
};
class KeyBoard{
public:
KeyBoard(){}
KeyBoard(char *kTyp)
{
strcpy(keyboardType,kTyp);
}
void setKeyboardType(char *kTyp)
{
strcpy(keyboardType,kTyp);
}
char *getKeyboardType()
{
return keyboardType;
}
private:
char keyboardType[20];
};
class Monitor{
public:
Monitor(){}
Monitor(char *mTyp)
{
strcpy(monitorType,mTyp);
}
char *getMonitorType()
{
return monitorType;
}
private:
char monitorType[20];
};
class Speaker{
public:
Speaker(){}
Speaker(int sSize)
{
speakerSize=sSize;
}
int getSpeakerSize()
{
return speakerSize;
}
private:
int speakerSize;
};
class CdRom{
public:
CdRom(){}
CdRom(char *cTyp)
{
strcpy(cdRomType,cTyp);
}
char *getCdRomType()
{
return cdRomType;
}
private:
char cdRomType[20];
};
void addSpeaker(int s)
{
sp=new Speaker(s);
}
void deleteSpeaker()
{
delete sp;
}
void addCdRom(char *ct)
{
cd=new CdRom(ct);
}
void deleteCdRom()
{
delete cd;
}
void setSpeaker(int s)
{
if(sp!=NULL)
sp->setSpeakerSize(s);
int getSpeaker()
{
if(sp!=NULL)
return sp->getSpeakerSize();
else
return -1;
char *getCdRom()
{
if(cd!=NULL)
return cd->getCdRomType();
else
return "?";
}
void setStatus(Status s)
{
status=s;
}
Status getStatus()
{
return status;
}
int getHdd()
{
hd.getHddCapacity();
}
int getRam()
{
r.getRamCapacity();
}
int getProcessor()
{
p.getProcessorSpeed();
}
char *setKeyBoard()
{
k.getKeyboardType();
}
char *setMonitor()
{
mo.getMonitorType();
}
private:
Status status;
Hdd hd;
Ram r;
Processor p;
Mouse m;
KeyBoard k;
Monitor mo;
Speaker *sp;
CdRom *cd;
};
http://www.ravianeducation.blogspot.com
FARHAN: 03008855006