Driving is expensive. Write a program with a car's miles/gallon and gas dollars/gallon (both doubles) as...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Driving is expensive. Write a program with a car's miles/gallon and gas dollars/gallon (both doubles) as input, and output the gas cost for 10 miles, 50 miles, and 400 miles. Output each floating-point value with two digits after the decimal point, which can be achieved by executing cout < < fixed < < setprecision (2); once before all other cout statements. Ex: If the input is: 20.0 3.1599 the output is: 1.58 7.90 63.20 Note: Real per-mile cost would also include maintenance and depreciation. 1832821679646 LAB 2251: LAB Driving costs 0/10 ACTIVITY main.cpp Load default template... for setprecision #include Driving is expensive. Write a program with a car's miles/gallon and gas dollars/gallon (both doubles) as input, and output the gas cost for 10 miles, 50 miles, and 400 miles. Output each floating-point value with two digits after the decimal point, which can be achieved by executing cout < < fixed < < setprecision (2); once before all other cout statements. Ex: If the input is: 20.0 3.1599 the output is: 1.58 7.90 63.20 Note: Real per-mile cost would also include maintenance and depreciation. 1832821679646 LAB 2251: LAB Driving costs 0/10 ACTIVITY main.cpp Load default template... for setprecision #include
Expert Answer:
Answer rating: 100% (QA)
include include include include include include using n... View the full answer
Related Book For
Posted Date:
Students also viewed these programming questions
-
Write a program with two radio buttons and a text field. When the user clicks on one radio button, the text changes to lowercase; when the user clicks on the other radio button, the text changes to...
-
Policymakers frequently search for ways to reduce consumption of gasoline. One straightforward option is to tax gasoline thereby encouraging consumers to drive less in their cars and switch to more...
-
The Superior Insurance Company of Maine recently advertised the following discounts for qualified drivers: 10 percent discount to drivers who have not had an accident in the past 7 years 15 percent...
-
Question 1 of 5 Which statement best illustrates Crusoe's reasons for teaching Friday about his religion? OA. He does not see Friday as a savage but as a soul worthy of saving. B. He thinks Friday...
-
A processing sequence consists of 10 operations, each of which is followed by an inspection and sortation operation to detect and remove defects generated in the processing operation. Defects in each...
-
Which of the following phenotypes is not an example of a wildtype phenotype? a. Yellow-flowered elderflower orchid b. Red-flowered elderflower orchid c. A gray elephant d. An albino (white) elephant
-
Eco Manufacturing Ltd produces timber felling machines for the forestry industry around the world. Its two machines are the Tree Toppler, which cuts down trees and clears undergrowth, and the Timber...
-
A volume of air(assumed to be an ideal gas) is first cooled with out changing its volume and then expanded without changing its pressure, as shown by the path abc in Fig. 19.30. (a) How does Ute...
-
Helix Corporation uses the weighted-average method of process costing. It produces prefabricated flooring in a series of steps carried out in production departments. All of the material used in the...
-
One of the biggest purchases we make in our lifetimes is for a home. Questions that we all ask are these: How much should I spend for a particular home? How many bathrooms are there? How long...
-
Two immiscible liquids, oil and water can be separated by using {fill_regular).
-
Question: Use the info below to answer the following questions:On January 1, Deacon Co. acquired a 40% interest in Pirate, Inc. for $1,000,000. At the time of purchase, the book value of the net...
-
2.Summarize the relationship between magnetism and current electricity. 7. What are magnetic domains? What are some different ways of representing magnetic domains? 4. What are some characteristics...
-
Robin Company has the following balances for the current month: Direct materials used Direct labor Sales salaries Indirect labor Production manager's salary Marketing costs Factory lease What is...
-
4. describe why "unification" is an important goal in science. 1.Discuss how magnets behave differently from electrostatically charged objects, for instance a balloon rubbed with fur. 11. How do...
-
Explain the differences between task context and interrupt context in an RTOS. How does an RTOS manage interrupt service routines to maintain real-time requirements ?
-
FIRST PROJECT MEMO: Sling TV stands out from other streaming services because it gives the flexibility to customize packages with add-on channels at a more affordable price, allowing viewers to move...
-
For the given transfer function: Vo(s) / Vi(s) = (s^2C^2R^2 + 1) / (s^2C^2R^2 + 4sCR + 1) Assumiing that 1/(CR) = 120 PI so write the matlab code to find the magnitude plot
-
1. Find the total amount in an account if $6000 is compounded semiannually at 11% for 10 years. 2. Find the total amount in an account if $100 is compounded quarterly at 12% for 5 years. 3. Find the...
-
1. The average daytime surface temperature of Mercury is 845F, while the average daytime surface temperature of Jupiter is -162F. Find the difference in temperatures. 2. In 2012, the United States...
-
Evaluate each following expression for x = 2, y = 5, and z = 3. 1. 3yz2 + 1 2. 3 + (2y - 4) 3. x4 - ( y - ) 4. 8yz / 15 5. 6 + 3x / z
-
(a) Find the Laplace transform of \(f(t)=50\left[e^{-100 t}-2 e ight.\) \(-200 t] u(t)\). (b) Locate the poles and zeros of \(F(s)\). (c) What is the time constant associated with each pole? (d)...
-
Find the Laplace transform of \(f(t)=\delta^{\prime}(t)+\delta(t)-e^{-t} u\) \((t)\). Locate the poles and zeros of \(F(s)\).
-
Find the Laplace transform of \(f(t)=A\left[(B+\alpha t) e^{-\alpha t} ight.\) ]\(u(t)\). Locate the poles and zeros of \(F(s)\).
Study smarter with the SolutionInn App