InterviewSolution
Saved Bookmarks
| 1. |
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 fee variable according to the style entered by the user according to the criteria as given below:StyleFeeClassical10000Western8000Freestyle11000Public 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 to the Style entered by the user.● A function display() to allow users to view the details of all the data members. |
|
Answer» class DanceAcademy { int Enrollno; char Name[20]; char Style[20]; float Fee; void chkfee() { if(strcmpi(Style, "Classical")==0) Fee=10000; else if(strcmpi(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: "<<Enrollno<<"\t"<<Name<<"\t"<<Style<<"\t"<<Fee; } }; |
|