1 answer

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

Question:

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.


Answers

#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

.

Similar Solved Questions

1 answer
5. Which score indicates the highest relative position? a. A score of 3 on a test...
5. Which score indicates the highest relative position? a. A score of 3 on a test with mean 4 and standard deviation b. A score of 610 on a test with mean 780 and standard deviation 100 c. A score of 42 on a test with mean 55 and standard deviation 6...
1 answer
Need help understanding this? QUESTION 8 Which one of the following compound is most acidic? ОН...
need help understanding this? QUESTION 8 Which one of the following compound is most acidic? ОН ОН ОН...
1 answer
How do you factor #x^3-5x+3#?
How do you factor #x^3-5x+3#?...
1 answer
Are guards at the factory classified as: Selling Cost, Overhead Cost or Administrative Cost? Is direct...
Are guards at the factory classified as: Selling Cost, Overhead Cost or Administrative Cost? Is direct material classified as: Selling Cost or Manufacturing Cost or Administrative Cost? Is Shop Foreman's Salary identified as indirect labor or direct labor or none of these?...
1 answer
What is the new classic macroeconomics model and what effect does government policy have on real...
What is the new classic macroeconomics model and what effect does government policy have on real Balance of Payments, real Inflation, real economic growth and real Unemployment?...
1 answer
45 9.6 4000.0 3000 2000 1333.83 1573.75 158968 144661 1500 1192 47 1000 75937 650.0
45 9.6 4000.0 3000 2000 1333.83 1573.75 158968 144661 1500 1192 47 1000 75937 650.0...
1 answer
Complete the following program based on the comments inside. Important note: You are only allowed to...
Complete the following program based on the comments inside. Important note: You are only allowed to use the new operator in solving this problem. (i.e. Don't use predefined array functions such as append(), concat(), etc. in solving this problem) Important Note 2: Your program should work the s...
1 answer
Please answer both questions D Question 25 1 pts Time Ru Attempt 1 Hour, e Campus...
Please answer both questions D Question 25 1 pts Time Ru Attempt 1 Hour, e Campus 24/7 Pr A health insurer suspects that the average fee charged by one particular clinic for a medical procedure is higher than $1200. The insurer wants to perform a hypothesis test to determine whether their suspi...
1 answer
In the figure below, the hanging object has a mass of m, = 0.480 kg; the...
In the figure below, the hanging object has a mass of m, = 0.480 kg; the sliding block has a mass of m, = 0.825 kg; and the pulley is a hollow cylinder with a mass of M = 0.350 kg, an inner radius of R4 = 0.020 0 m, and an outer radius of R, = 0.030 0 m. Assume the mass of the spokes is negligible. ...
2 answers
The hypothetical machine of Figure 3.4 has two I/O instructions: 0011 = Load AC from I/O...
The hypothetical machine of Figure 3.4 has two I/O instructions: 0011 = Load AC from I/O 0111 = Store AC to I/O In these cases, the 12-bit address identifies a particular I/O device. Show the program execution (using the format of Figure 3.5) for the following program: 1. Load AC from device 5. 2. A...
1 answer
AbleVision has been approached by the City of Mirada to run its cable operations in 2020....
ableVision has been approached by the City of Mirada to run its cable operations in 2020. After negotiating with key parties, CableVision has made the following agreements: It will offer Mirada residents a basic set of 25 cable television stations at a rate of $32.99 per month. It will pay the city ...
2 answers
If a 0.489 M solution of L-ascorbic acid is being prepared what mass of solid (in grams) must be added to make a 500 ml of solution?
If a 0.489 M solution of L-ascorbic acid is being prepared what mass of solid (in grams) must be added to make a 500 ml of solution?...
1 answer
5) GIVEN THE VOLTAGE WAVEFORMDETERMINE THE VARIATIONS IN CURRENT C = 100 nF 20% i(t) 2...
5) GIVEN THE VOLTAGE WAVEFORMDETERMINE THE VARIATIONS IN CURRENT C = 100 nF 20% i(t) 2 v(t) C (A) (a)a n -2 -3 O 1 2. 5 6 3 4 Time (s)...
1 answer
Sons Parts CORTELMATKU ODU S question Inventory Costing Methods-Periodic Method Chen Sales Corporation uses the periodic...
Sons Parts CORTELMATKU ODU S question Inventory Costing Methods-Periodic Method Chen Sales Corporation uses the periodic inventory system. On January 1, 2012, Chen had: 1,000 units of product A with a unit cost of $50 per unit. A summary of purchases and sales during 2012 follows: Feb 2 Apr.6 July 1...
1 answer
Firms usually faces obstacles to implementing price discrimination. Describe and explain the main obstacles faced by...
Firms usually faces obstacles to implementing price discrimination. Describe and explain the main obstacles faced by firms. How do these obstacles affect the strategies of price discrimination that firms can use?...
1 answer
Use the MACRS 5-year schedule to determine the maximum yearly depreciation allowance for a piece of...
Use the MACRS 5-year schedule to determine the maximum yearly depreciation allowance for a piece of equipment that has an original value of $ 130,000, including double declining balance switching to straight-line method with half-year convention. Please show all your calculations, and then list the ...
1 answer
Chapeau Company, a U.S. corporation, operates through a branch in Champagnia. The source rules used by...
Chapeau Company, a U.S. corporation, operates through a branch in Champagnia. The source rules used by Champagnia are identical to those used by the United States. For 2019, Chapeau has $10,800 of gross income: $6,480 from U.S. sources and $4,320 from sources within Champagnia. The $6,480 of U.S. so...