Question

This is the question of the textbook an introduction to programming with C++, 8th edition. 16....

This is the question of the textbook an introduction to programming with C++, 8th edition.

16. In this exercise, you will modify the tip program shown earlier in Figure 7-31. Follow the instructions for starting C++ and viewing the ModifyThis16.cpp file, which is con- tained in either the Cpp8\Chap07\ModifyThis16 Project folder or the Cpp8\Chap07 folder. (You may need to open the project/solution file first.) Change the for statement to a while statement. Save and then run the program. Test the program using 90.50 as the restaurant bill. The three tips should appear as shown earlier in Figure 7-32.

0 0
Add a comment Improve this question Transcribed image text
Answer #1
#include<iostream>

using namespace std;

int main()
{
   double bill = 0.0;
   
   double tip = 0.0;
   
   cout << "Bill amount: ";
   cin >> bill;//Input bill from the user
   
   double rate = 0.1;
   while(rate <= 0.2)
   {
      tip = bill * rate;
      
      cout << rate * 100 << "% tip: ";
      cout << "$" << tip << endl;
      rate += 0.05;
   }  //end while
   system("pause");
   return 0;
}

OUTPUT:

CAUsers Shubham Desktop Main.exe Bill amount: 90.50 10% tip: $9.05 15% tip: $13.575 20% tip: $18.1 Press any key to continue

Add a comment
Know the answer?
Add Answer to:
This is the question of the textbook an introduction to programming with C++, 8th edition. 16....
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • An Introduction to Programming With C++ (8th Edition) Chapter 9, Exercise 18

    An Introduction to Programming With C++ (8th Edition) Chapter 9, Exercise 18

  • In this exercise, you will modify the hypotenuse program shown earlier in Figure 9-6. Follow the...

    In this exercise, you will modify the hypotenuse program shown earlier in Figure 9-6. Follow the instructions for starting C++ and viewing the ModifyThis13.cpp file, which is contained in either the Cpp8/Chap09/ModifyThis13 Project folder or the Cpp8/Chap09 folder. Remove both calculation tasks from the main function, and assign both to a program-defined value-returning function named getHypotenuse. Test the program appropriately. //Hypotenuse.cpp - displays the length of a right //triangle's hypotenuse #include <iostream> #include <iomanip> #include <cmath> using namespace std; int...

  • chapter 7. Create a program that allows the user to enter the ages (in years) of...

    chapter 7. Create a program that allows the user to enter the ages (in years) of five people. The program should display the average age. Use the for the statement. Display the average age with one decimal place. If necessary, create a new project named TryThis15 Project, and save it in the Cpp8\Chap07 folder. Enter the C++ instructions into a source file named TryThis15.cpp. Also, enter appropriate comments and any additional instructions required by the compiler. Test the program using...

  • Assembly Program/Language Textbook: Introduction to 64 Bit Assembly Programming for Linux and OS X, 3rd Edition,...

    Assembly Program/Language Textbook: Introduction to 64 Bit Assembly Programming for Linux and OS X, 3rd Edition, Ray Seyfarth Chapter 7 - Exercise 1 & 2: Write an assembly program to count all the 1 bits in a byte stored in memory. Use repeated code rather than a loop. Write an assembly program to swap 2 quad-words in memory using xor. Use the following algorithm:      a = a ^ b      b = a ^ b      a = a ^ b

  • Assembly Program/Language Textbook: Introduction to 64 Bit Assembly Programming for Linux and OS X, 3rd Edition,...

    Assembly Program/Language Textbook: Introduction to 64 Bit Assembly Programming for Linux and OS X, 3rd Edition, Ray Seyfarth Chapter 9 - Exercise 3: 9.3. A Pythagorean triple is a set of three integers, ?, ? and ?, such that ? 2 + ? 2 = ? 2 . Write an assembly program to print all the Pythagorean triples where ? <= 500. Use a function to test whether a number is a Pythagorean triple.

  • An Introduction to Programming Using Visual Basic Tenth Edition Chapter 3 Programming Project 3 What is...

    An Introduction to Programming Using Visual Basic Tenth Edition Chapter 3 Programming Project 3 What is the solution to this project? Change X Amount of change: 93 Determine Composition of Change Quarters: 3 Dimes: 1 Nickels: 1 Cents: 3 FIGURE 3.63 Possible outcome of Programming Project 3. own in Fig. 3.62. 3. Change Write a program to make change for an amount of money from 0 through 99 cents input by the user. The output of the program should show...

  • An Introduction to Programming Using Visual Basic Tenth Edition Chapter 3 Programming Project 2 What is...

    An Introduction to Programming Using Visual Basic Tenth Edition Chapter 3 Programming Project 2 What is the solution to this project? one of the numbers in an input text box is change the type of Auto Repair Calculator X Customer: John Doe Hours of labor: 3.5 Cost of parts and supplies 84.55 Display Bill + First number 21 Second number 77 х Customer Labor cost Parts cost Total cost John Doe $122.50 $88.78 $211.28 21 x 77 = 1617 FIGURE...

  • 25. In this exercise, you create a program for the sales manager at Computer Haven, a...

    25. In this exercise, you create a program for the sales manager at Computer Haven, a small business that offers motivational seminars to local companies. Figure 7-53 shows the charge for attending a seminar. Notice that the charge per person depends on the number of people the company registers. For example, the cost for four registrants is $400; the cost for two registrants is $300. The program should allow the sales manager to enter the number of registrants for as...

  • What am I doing wrong here...…. Question is this : In this exercise, you will create...

    What am I doing wrong here...…. Question is this : In this exercise, you will create a program that displays a table consisting of four rows and three columns. The first column should contain the numbers 10 through 13. The second and third columns should contain the results of squaring and cubing, respec- tively, the numbers 10 through 13. The table will look similar to the one shown in Figure 9-38. If necessary, create a new project named Introductoryl6 Project,...

  • Mountain Coffee wants a program that allows a clerk to enter the number of pounds of...

    Mountain Coffee wants a program that allows a clerk to enter the number of pounds of coffee ordered, the price per pound, and whether the customer should be charged a 3.5% sales tax. The program should calculate and display the total amount the customer owes. Use an int variable for the number of pounds, a double variable for the price per pound, and a char variable for the sales tax information. a. Create an IPO chart for the problem, and...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT