MENU
Question -

Define a class CONTEST folowing description:
Private Data Members

Eventno               integer
Description         char(30)
Score                    integer
Qualified             char

Public Member functions
• A constructor to assign initial values Evento as 11, Description’s “School level”, Score as 100, Qualified as ‘N’
• Input()-To take the input for Eventno, Description and Score.
• Award (int cutoffscore) – To assign Qualified as ‘Y’, If score is more than the cutoffscore that is passed as argument to the function, else assign Qualified as ‘N’.
• Displaydata()-to display all the data members.



Answer -

class CONTEST
 {
 private :
 int Eventno;
 char ‘Description [30];
 public :
 Contest () ;
 void Input () ;
 void Award (int cutoffscore);    [1]
 void Display ();
 };
 Contest : : contest()
 {
 Evento =11 ;
 Description = "school level" ;
 Score = 100;
 Qualified = 'N' ;
 }    [1]
 void Contest : : Input ( )
 {
 cin >> Eventno;
 gets (Description);
 cin >> Score ;
 }    [1]
 void CONTEST : :    Award (in cut of
 score)
 {
 int K = cutoffscore ;
 (Score > K)
 Qualified = 'Y' ;
 else
 Qualified = 'N' ;
 }
 void CONTEST ()
 {
 cout << Event No : << Eventno << endl ;
 cout << Description :    <<
 Description << endl;
 cout << Score : << Score << Endl
 cout << Qualified : << Qualified << endl;
 } 

Comment(S)

Show all Coment

Leave a Comment

Free - Previous Years Question Papers
Any questions? Ask us!
×