C++ Programming: From Problem Analysis to Program Design
C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN: 9781337102087
Author: D. S. Malik
Publisher: Cengage Learning
bartleby

Concept explainers

bartleby

Videos

Textbook Question
Book Icon
Chapter 4, Problem 20PE

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 at least 10, the discount is 10%; at least 20, the discount is 20%; and at least 30, the discount is 30%. Also if rooms are booked for at least three days, then there is an additional 5% 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.

Blurred answer
Students have asked these similar questions
Using Paython Write a program that asks a student for his grade (out of 100) in 3 exams and then print out his final grade (out of 100), given that the weight of the first exam is 30%, the second 30%, and the third 40%.Example Input:Exam1: 70Exam2: 80Exam3: 90Example Output:Total Grade = 81Explanation: 0.3 * 70 + 0.3 * 80 + 0.4 * 90 = 81
Suppose you can buy chocolate bars from a vending machine for $1 each.Inside every chocolate bar is a coupon. You can redeem 7 coupons for 1chocolate bar from the machine.For example, if you have $20, you can initially buy 20 chocolate bars.This gives you 20 coupons. You can redeem 14 coupons for 2 additionalchocolate bars. These 2 chocolate bars have 2 more coupons, so you now have atotal of 8 coupons. This gives you enough to redeem for 1 final chocolate bar.Write a recursive function that would accept the amount of dollars andcoupons as its parameters and output the total number of chocolate bars thatcan be bought (including those redeemed via coupons).Write a test program in C++that would allow the user to enter amount of dollarsand then use the recursive function to compute the number of chocolate barsthe user can buy, and output the number to the screen.
Let's modify the program from this section so that the user can supply the interest rate. For very small interest rates, it may take a very long time for the balance to double. Assume the user can't wait for more than twenty years. Stop adding interest when the balance has doubled or twenty years have elapsed. 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27     finaldoubleTARGET=2*INITIAL_BALANCE;   doublebalance=INITIAL_BALANCE; intyear=0;   Scannerin=newScanner(System.in); System.out.print("Interest rate in percent: "); doublerate=in.nextDouble();   // TODO: Count the years required for the investment to double // but no more than 20 years   /* Your code goes here */   System.out.println("Year: "+year); System.out.printf("Balance: %.2f%n", balance); }
Knowledge Booster
Background pattern image
Computer Science
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
SEE MORE QUESTIONS
Recommended textbooks for you
Text book image
Programming Logic & Design Comprehensive
Computer Science
ISBN:9781337669405
Author:FARRELL
Publisher:Cengage
Control Structure in Data Structure - Data Structures - Computer Science Class 12; Author: Ekeeda;https://www.youtube.com/watch?v=9FTw2pXLhv4;License: Standard YouTube License, CC-BY