58.1k views
5 votes
Your task is to create a program that computes the total cost of reserving one or more hotel rooms for a specified number of days. An off-season room is $50.00 per night, and during the on-season it is $100.00 per night. When a group reserves 6 rooms or more they get a discount of 10% on the reservation cost. Some states have a sales tax which is a fraction of the discounted reservation cost. The total cost will be computed as the sum of the discounted reservation cost plus taxes. Note: it will count against you if you tax them on the reservation cost before any discounts are applied!

1 Answer

0 votes

Answer:

C++.

Step-by-step explanation:

int main() {

int off_cost = 50;

int on_cost = 100;

float discount = 0.1;

string season = "off season";

///////////////////////////////////////////////////////////////////////////

int no_of_rooms = 0;

cout<<"How many rooms? ";

cin>>no_of_rooms;

cout<<endl;

///////////////////////////////////////////////////////////////////////////

float total_cost = 0;

if (season == "off season") {

if (no_of_rooms > 5) {

total_cost = (no_of_rooms * off_cost) - ((no_of_rooms * off_cost) * discount);

// With tax

// total_cost = total_cost + (total_cost * fraction);

}

else

total_cost = (no_of_rooms * off_cost);

}

///////////////////////////////////////////////////////////

else {

if (no_of_rooms > 5) {

total_cost = (no_of_rooms * on_cost) - ((no_of_rooms * on_cost) * discount);

// With tax

// total_cost = total_cost + (total_cost * fraction);

}

else

total_cost = (no_of_rooms * on_cost);

}

///////////////////////////////////////////////////////////////////////////

cout<<"Total cost = "<<total_cost;

return 0;

}

User Roqz
by
3.7k points