1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Crank
3 years ago
9

Driving is expensive. Write a program with a car's miles/gallon and gas dollars/gallon (both doubles) as input, and output the g

as cost for 20 miles, 75 miles, and 500 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.
Computers and Technology
1 answer:
zepelin [54]3 years ago
8 0

Answer:

Explanation:

The following is written in C++ and asks the user for inputs in both miles/gallon and dollars/gallon and then calculates the gas cost for the requested mileages using the input values

#include <iostream>

#include <iomanip>

using namespace std;

int main () {

   // distance in miles

   float distance1 = 20.0, distance2 = 75.0, distance3 = 500.0;

   float miles_gallon, dollars_gallon;

   cout << "Enter cars miles/gallon: "; cin >> miles_gallon;

   cout << "Enter cars dollars/gallon: "; cin >> dollars_gallon;

   cout << "the gas cost for " << distance1 << " miles is " << fixed << setprecision(2) << (float) dollars_gallon * distance1 / miles_gallon << "$\n";

   cout << "the gas cost for " << distance2 << " miles is " << fixed << setprecision(2) << (float) dollars_gallon * distance2 / miles_gallon << "$\n";

   cout << "the gas cost for " << distance3 << " miles is " << fixed << setprecision(2) << (float) dollars_gallon * distance3 / miles_gallon << "$\n";

   return 0;

}

You might be interested in
After unit and integration testing are completed, _________ testing ensures that all hardware and software components work toget
raketka [301]
Testing ensures that all hardware and software components work together
5 0
2 years ago
¿Cuales son las empresas mas exitosas que aún usan hoja de cálculo? porfa es urgentee
dem82 [27]

Answer:excel

Explanation:

6 0
2 years ago
The sum of these 9 numbers is 36. 2, 2, 6, 2, 1, 8, 7, 5, 3 What is the mean of these 9 numbers?
fiasKO [112]

Answer:

4

Explanation:

The mean is the sum divided by the count of numbers, so 36/9 = 4

6 0
2 years ago
Read 2 more answers
The viewer of an OLAP report can change its format. Which term implies this capability?
amm1812

Answer:

The answer is "Option D".

Explanation:

OLAP reports stands for Online Analytical Processing reports, These reports provide a platform that behind many application use in Business Intelligence. and other options are incorrect that can be described as follows:

  • In option A, It is used to store the data into the OLAP report, that's why it is not correct.
  • In option B, It is software that is used for analytics data, that's why it is not correct.
  • In option C, It is used for finding index values in the 2D array that's why it is not correct.
3 0
3 years ago
Read 2 more answers
How can I change my username here at brainly?
velikii [3]

Answer:

Explanation:

LOG OUT AND CHANGE IT

3 0
3 years ago
Read 2 more answers
Other questions:
  • ________ is digital textual information that can be stored, manipulated, and transmitted by electronic devices.
    7·1 answer
  • Consider this data sequence: "fish bird reptile reptile bird bird bird mammal fish". let's define a singleton to be a data eleme
    5·1 answer
  • Why is it important to begin development of a software solution with a programming design in place? A programming design summari
    11·2 answers
  • Which command provides the source refrence at the bottom of the current page of a document?
    5·1 answer
  • According the Keown book, which Web-based personal financial planning website is known as "the best free way to manage your mone
    6·1 answer
  • Suppose that a is a one-dimensional array of ints with a length of at least 2. Which of the following code fragments successfull
    8·1 answer
  • Difference between a software package and Integrated software and why users would choose one over the other
    8·1 answer
  • 10. Differentiate between equity share &amp; preference share.​
    11·1 answer
  • Why do people make Among Us games on Ro-blox, and thousands of people play them, when Among Us is free on all devises?
    10·1 answer
  • What power points feature will you use to apply motion effects to different objects of a slide
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!