QUESTION 2: In this question, we describe the problem and then you have to decid
ID: 3705632 • Letter: Q
Question
QUESTION 2: In this question, we describe the problem and then you have to decide yourself how you are going to tackle it. Question 2a The cost of renting a romm at a hotel is R900 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%; if the number of rooms booked is at least 20, the discount is 20%; if the number of rooms booked is greater or equal 30, the discount is 30%; * In addition, if rooms are booked for at leas three days, there is an additional 5% discount. Write a program that promps the user ro enter the cost of renting one room, the number of rooms booked, the number of days the rooms are booked and theslaws tax (as a percent). Display the output as follows: Please enter the following: cost per room: 1000 sales tax per room: 10 the number of rooms: 35 number of days: 2 The total cost for one room is R1000 The discount per room is 30% The number of rooms booked: 35 The total cost of the rooms are R: 70000 COS1511/102/1/2018 The sales tax paid is :10% The total cost per booking is R77000 submit Submit a printout of the program and outputExplanation / Answer
Source file : https://ideone.com/jCref4
#include <stdio.h>
int main(void) {
int cpr,tax,days,nr,disc=0;
printf("Please Enter the following: ");
printf("Cost per room:");
scanf("%d",&cpr);
printf("Sales tax per room:");
scanf("%d",&tax);
printf("The Number of room(s):");
scanf("%d",&nr);
printf(" Number of day(s):");
scanf("%d",&days);
printf("The total cost for one room is R%d ",cpr);
if(nr>=30) disc=30;
else if(nr>=20) disc=20;
else if(nr>=10) disc=10;
if(days>=3)disc+=5;
printf("Discount per room is %d%c ",disc,'%');
printf("No of rooms booked %d ",nr);
printf("Total cost of rooms are R %ld ",cpr*days*nr);
printf("Sales Tax paid is %d%c ",tax,'%');
printf("Total cost per booking is %.2f",(cpr*days*nr)*(1+((float)tax/100)));
// your code goes here
return 0;
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.