Write a programme to define a class named resort with following
specifications: Private members/functions : roll_no, customer name, charge per day, stay time , a function compute to calculate the total cost of stay Public members/functions : a function to read the information and a function to display information. (special condition ,if the total cost is more than 11000 then total cost is equal to (charge_per_day) * (days_of_stay)* 1.02 )
class resort { int room_no; char customer_nm[20]; float charge_per_day; int days_of_stay; float compute( float charge_per_day , int days_of_stay ) { float total; total= (charge_per_day) * (days_of_stay); if(total>11000) { total= (charge_per_day) * (days_of_stay)*1.02; } return total; }
public: void readinfo(); void displayinfo();
} customer1;
void resort::readinfo() {
cout<<"Enter the room number:"; cin>>room_no; cout<<"\nEnter the customer name:"; gets(customer_nm); cout<<"\nEnter the room charges per day:"; cin>>charge_per_day; cout<<"\nEnter the number of days of stay:"; cin>>days_of_stay; }
void resort::displayinfo() { cout<<"\nRoom number is:"<<room_no; cout<<"\nName of the customer is:"<<customer_nm; cout<<"\nRoom charge per day is:"<<charge_per_day; cout<<"\nStay(days):"<<days_of_stay; cout<<"\nTotal charges:"<<compute(charge_per_day,days_of_stay); }