Define a class TEST in C++ with following description:
Private Members
TestCode of type integer
Description of type string
NoCandidate of type integer
CenterReqd (number of centers required) of type integer
A member function CALCNTR() to calculate and return the number of centers as
(NoCandidates/100+1)
Public Members
A function SCHEDULE() to allow user to enter values for TestCode, Description,
NoCandidate & call function CALCNTR() to calculate the number of Centres.
A function DISPTEST() to allow user to view the content of all the data members.
#include <iostream>
#include <string>
using namespace std;
class TEST{
int TestCode, NoCandidate, CenterReqd;
string Description;
int CALCNTR(){
return NoCandidate/100+1;
}
public:
TEST(){}
void SCHEDULE(){
cout<<"Enter test code: "; cin>>TestCode;
cout<<"Enter description: "; cin>>Description;
cout<<"Enter NoCandidate: "; cin>>NoCandidate;
CenterReqd = CALCNTR();
}
void DISPTEST(){
cout<<"Test Code: "<<TestCode<<endl;
cout<<"Description: "<<Description<<endl;
cout<<"NoCandidate: "<<NoCandidate<<endl;
cout<<"Number of Centers required: "<<CenterReqd<<endl;
}
};
Comments
Leave a comment