Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Please complete using c + + The cost of renting a room at a hotel is , say $ 1 0 0 . 0 0
Please complete using c
The cost of renting a room at a hotel is say $ 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 the discount is ; at least the discount is ; and at least the discount is Also if rooms are booked for at least three days, then there is an additional discount. 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, and 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, and the total billing amount. Your program must use appropriate named constants to store special values such as various discounts.
Here is my code but im failing on correct output for less than rooms, and o or more rooms. Please look over the code to see where my mistakes are.
#include
#include
using namespace std;
Constants for discounts and sales tax
const double DISCOUNTROOMS ;
const double DISCOUNTROOMS ;
const double DISCOUNTROOMS ;
const double ADDITIONALDISCOUNT ;
int main
Variables to store user input
double roomCost, salesTax;
int numRooms, numDays;
Prompt user for input
cout "Enter the cost of renting one room: $;
cin roomCost;
cout "Enter the number of rooms booked: ;
cin numRooms;
cout "Enter the number of days the rooms are booked: ;
cin numDays;
cout "Enter the sales tax rate as a percent: ;
cin salesTax;
Calculate total cost without considering discounts
double totalCost roomCost numRooms numDays;
Apply discounts based on the number of rooms booked
double discount ;
if numRooms
discount DISCOUNTROOMS;
else if numRooms
discount DISCOUNTROOMS;
else if numRooms
discount DISCOUNTROOMS;
Apply additional discount for booking at least three days
if numDays
discount ADDITIONALDISCOUNT;
Calculate discounted cost
double discountedCost totalCost totalCost discount;
Calculate sales tax amount
double taxAmount discountedCost salesTax ;
Calculate total billing amount
double totalAmount discountedCost taxAmount;
Output results
cout fixed setprecision;
cout
Cost of renting one room: $ roomCost endl;
cout "Discount on each room: discount endl;
cout "Number of rooms booked: numRooms endl;
cout "Number of days the rooms are booked: numDays endl;
cout "Total cost of the rooms: $ totalCost endl;
cout "Sales tax: salesTax endl;
cout "Total billing amount: $ totalAmount endl;
return ;
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started