Page 349 - C++
P. 349
CBSE AISSCE 2017-2018 Marking Scheme for Computer Science
(2018-2019 Sub Code: 083 Paper Code: 91)
{
float Radius, Height;
int Type;
float Volume;
void CalVolume();
public:
void GetValues();
void ShowAll();
};
void CONTAINER::GetValues()
{
cin>>Radius>>Height>>Type ;
CalVolume();
}
void CONTAINER::ShowAll()
{
cout<<Radius<<Height<<Type<<Volume<<endl;
}
OR
void CONTAINER::CalVolume() void CONTAINER::CalVolume()
{ {
if (Type == 1) switch (Type)
Volume=3.14*Radius*Height; {
else if (Type == 2) case 1:
Volume=3.14*Radius*Height/3; Volume =3.14*Radius*Height;
} break;
case 2:
Volume=3.14*Radius*Height/3;
}
}
(½ Mark for declaring class header correctly)
(½ Mark for declaring data members correctly)
(1 Mark for defining CalVolume() correctly)
(½ Mark for taking inputs of Radius, Type and Height in GetValues())
(½ Mark for invoking CalVolume() inside GetValues())
(½ Mark for defining ShowAll() correctly)
(½ Mark for correctly closing class declaration with a semicolon ; )
NOTE:
● Marks to be awarded for defining the member functions inside or
outside the class
● Marks not to be deducted for replacing the Formulae for calculating
Page #7/35