Answer to Question #173076 in C++ for Vimal D

Question #173076

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


1
Expert's answer
2021-03-20T13:12:20-0400

#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;

}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS