MENU
Question -

Define a class DanceAcademy in C++ with following description :
Private Members :
•    Enrollno of type int
•    Name of type string
•    Style of type string
•    Fee of type float
•    A member function chkfee( ) to assign the value of feevariable according to the style entered by the user according to the criteriaas given below.

Style

Fee

Classical

10000

Western

8000

Freestyle

11000

Public Members
• A function enrollment) to allow users to enter values for Enrollno, Name,Style and call function chkfee( ) to assign value of fee variable according tothe Style entered by the user.
• A function display( ) to allow users to view the details of all the datamembers.

 



Answer -

class Dance Academy
int Enrollno;   
char Name[20];
Char, style[20-]
Float Fee; 
void chkfee()
{
if(strcmpi(Style."Classical")==0) 
Fee=10000;
else if(strcrapi(Style,"Western")==0)
Fee=8000;
else if(strcmpi(Style,"Freestyle")==0)
Fee=11000; 
}
public;
void enrollment()
{
cout<<"Please enter Enrollno,Name,Style";
cin>>Enrollno;
gets(Name);
gets(Style);
chkfee();
}
void display()
{
cout<<"\n Entered Enrollno, Name Style, and Fee is:
"<
}
};

Comment(S)

Show all Coment

Leave a Comment

Free - Previous Years Question Papers
×