CS201 Assignment No. 4 Sol
CS201 assignment solution 2016
#include <iostream>
#include <string.h>
#include <stdio.h>
using namespace std;
class Keyboard
{
private:
string Model;
int Albkeys;
int Funckeys;
int Numkeys;
public:
Keyboard()
{
cout"\nKeyboard created\n";
Model = "";
Albkeys = 0;
Numkeys = 0;
Funckeys = 0;
}
void SetModel(string model)
{
Model = model;
}
string GetModel()
{
return Model;
}
void SetAlbkeys(int albkeys)
{
Albkeys = albkeys;
}
int GetAlbkeys()
{
return Albkeys;
}
void SetNumkeys(int numkeys)
{
Numkeys = numkeys;
}
int GetNumkeys()
{
return Numkeys;
}
void SetFunckeys(int funckeys)
{
Funckeys = funckeys;
}
int GetFunckeys()
{
return Funckeys;
}
void DisplayInfo()
{
cout"\n Model = "GetModel()endl;
cout"\n Albleys = "GetAlbkeys()endl;
cout"\n Numkeys = "GetNumkeys()endl;
cout"\n Funckeys = "GetFunckeys()endl;
cout"\n Keyboard assigned..!!\n";
//cout"\n Keyboard destroyed!!";
}
~Keyboard()
{
cout"\n Keyboard destroyed\n";
}
};
int main()
{
string mod;
int albkeys, numkeys, funckeys;
cout"\n Model = ";
cin>>mod;
cout"\n Albkeys = ";
cin>>albkeys;
cout"\n Numkeys = ";
cin>>numkeys;
cout"\n Funckeys = ";
cin>>funckeys;
Keyboard keyboard;
keyboard.SetModel(mod);
keyboard.SetAlbkeys(albkeys);
keyboard.SetNumkeys(numkeys);
keyboard.SetFunckeys(funckeys);
keyboard.DisplayInfo();
return 0;
}
#include <string.h>
#include <stdio.h>
using namespace std;
class Keyboard
{
private:
string Model;
int Albkeys;
int Funckeys;
int Numkeys;
public:
Keyboard()
{
cout"\nKeyboard created\n";
Model = "";
Albkeys = 0;
Numkeys = 0;
Funckeys = 0;
}
void SetModel(string model)
{
Model = model;
}
string GetModel()
{
return Model;
}
void SetAlbkeys(int albkeys)
{
Albkeys = albkeys;
}
int GetAlbkeys()
{
return Albkeys;
}
void SetNumkeys(int numkeys)
{
Numkeys = numkeys;
}
int GetNumkeys()
{
return Numkeys;
}
void SetFunckeys(int funckeys)
{
Funckeys = funckeys;
}
int GetFunckeys()
{
return Funckeys;
}
void DisplayInfo()
{
cout"\n Model = "GetModel()endl;
cout"\n Albleys = "GetAlbkeys()endl;
cout"\n Numkeys = "GetNumkeys()endl;
cout"\n Funckeys = "GetFunckeys()endl;
cout"\n Keyboard assigned..!!\n";
//cout"\n Keyboard destroyed!!";
}
~Keyboard()
{
cout"\n Keyboard destroyed\n";
}
};
int main()
{
string mod;
int albkeys, numkeys, funckeys;
cout"\n Model = ";
cin>>mod;
cout"\n Albkeys = ";
cin>>albkeys;
cout"\n Numkeys = ";
cin>>numkeys;
cout"\n Funckeys = ";
cin>>funckeys;
Keyboard keyboard;
keyboard.SetModel(mod);
keyboard.SetAlbkeys(albkeys);
keyboard.SetNumkeys(numkeys);
keyboard.SetFunckeys(funckeys);
keyboard.DisplayInfo();
return 0;
}