# Issue

This Content is from Stack Overflow. Question asked by Elizabeth Dean

I have been smashing my head against my keyboard for days and haven’t gotten any help in any of my usual places. Someone please wave a wand and tell me what I’m doing wrong! When I run my code I get proper output for up to 19 rooms, once 20 is hit it’s not outputting a discount. I have tried to rewrite the “if” statements several different ways and even went to a switch/break setup and it’s the same issue every single time. I have a logical error and CANNOT find it!

The assignment is “The cost of renting a room at a hotel is, say \$100.00 per night. For special occasions, such as a wedding or conference, the hotel offers a special discount as follows.

If the number of rooms booked is:

at least 10, the discount is 10%
at least 20, the discount is 20%
at least 30, the discount is 30%
Also if rooms are booked for at least three days, then there is an additional 5% discount.

Instructions
Write a program that prompts the user to enter:

The cost of renting one room
The number of rooms booked
The number of days the rooms are booked
The sales tax (as a percent).
The program outputs:

The cost of renting one room
The discount on each room as a percent
The number of rooms booked
The number of days the rooms are booked
The total cost of the rooms
The sales tax
The total billing amount.

My code is

`````` #include<iostream>
#include<`iomanip`>

`using namespace std`;

`int main`()
{

const float discount_10=0.10;
const float discount_20=0.20;
const float discount_30=0.30;

cout << fixed << showpoint;
cout << setprecision(2);

//Variables
double total_discount, final_bill, tax, base_cost, total_cost, room_cost, sales_tax;
int num_rooms, num_of_days;

cout<<"Enter the cost of renting one room: \$";
cin>>base_cost;

cout<<"Enter the number of rooms booked: ";
cin>>num_rooms;

cout<<"Enter number of days the rooms are booked: ";
cin>>num_of_days;

cout<<"Enter sales tax(%): ";
cin>>sales_tax;

if(num_rooms>=30)
total_discount = discount_30;

else if(num_rooms>=20 && num_rooms<=29)
total_discount = discount_20;

else if(num_rooms>=10 && num_rooms<=19)
total_discount = discount_10;

else if (num_rooms >=9)
total_discount =0;

if(num_of_days>=3)

else if (num_of_days<3)
total_discount = 0;

room_cost = (base_cost * num_of_days * num_rooms);

//Total cost for all rooms
total_cost = room_cost - (room_cost * total_discount);

tax = total_cost * (sales_tax/100);

//Final bill
final_bill=total_cost+tax;

cout<<"Cost of one room:" << base_cost <<endl;
cout<<"Discount:" << total_discount *100<<"%"<<endl;
cout<< "Rooms booked:" << num_rooms <<endl;
cout<<"Days booked: " << num_of_days <<endl;
cout<<"Total Cost: \$" << total_cost<<endl;
cout<<"Sales tax: "<<tax<< "%"<< endl;
cout<<"Total bill: \$" << final_bill << endl;

return 0;
}
``````

I’ve rewritten this thing about a dozen times and can’t find it. I’m going nuts.

# Solution

This question is not yet answered, be the first one who answer using the comment. Later the confirmed answer will be published as the solution.

```