Define a class TEST with the 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
SCHEDULE() A function SCHEDULE() to allow user to enter values for TestCode, Description, NoCandidate & call function CALCNTR() to calculate the number of Centres. DISPTEST() A function DISPTEST() to allow user to view the content of all the data members
#include<iostream>
using namespace std;
class TEST {
private:
int TestCode;
string Description;
int NoCandidates;
int CALCNTR() {
return (NoCandidates/100+1);
}
public :
void SCHEDULE();
void DISPTEST();
};
void TEST::SCHEDULE () {
cout<<"Enter TestCode: ";
cin>> TestCode;
cout<<"Enter Description: ";
cin.ignore();
getline(cin, Description);
cout<<"Enter NoCandidate: ";
cin >> NoCandidates ;
int number_of_centers = CALCNTR();
cout<<"================================="<<endl;
}
void TEST ::DISPTEST() {
cout<<"TestCode: "<<TestCode<<endl
<<"Description: "<<Description<<endl
<<"NoCandidates "<<NoCandidates<<endl
<<"number_of_centers "<<CALCNTR()<<endl;
}
int main()
{
TEST myTEST ;
myTEST.SCHEDULE();
myTEST.DISPTEST();
return 0;
}
Comments
Leave a comment