InterviewSolution
Saved Bookmarks
| 1. |
Define a class DanceAcademy in C++ with following description:Private Members Enroll no of type intName 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:Public MembersA 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[15]; char Style[15]; 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 enroll no, name and style"; cin>>Enrollno>>Name>>Style; chkfee(); } void display() { cout<<"\n Entered Enrollno is" <<"\t"<<Enrollno; cout<<"\n Entered Name is"<<"\t"<<Name; cout<<"\n Entered Style is:"<<<"\t"<<Style; cout<<<"\n and Fee is : "<<"\t"<<Free; } }; |
|