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
liraira [26]
3 years ago
10

C++

Computers and Technology
2 answers:
egoroff_w [7]3 years ago
5 0

Answer:

def driving_cost(driven_miles, miles_per_gallon, dollars_per_gallon):

  gallon_used = driven_miles / miles_per_gallon

  cost = gallon_used * dollars_per_gallon  

  return cost  

miles_per_gallon = float(input(""))

dollars_per_gallon = float(input(""))

cost1 = driving_cost(10, miles_per_gallon, dollars_per_gallon)

cost2 = driving_cost(50, miles_per_gallon, dollars_per_gallon)

cost3 = driving_cost(400, miles_per_gallon, dollars_per_gallon)

print("%.2f" % cost1)

print("%.2f" % cost2)

print("%.2f" % cost3)

Explanation:

Cerrena [4.2K]3 years ago
4 0

Answer:

#include <iostream>

#include<iomanip>

using namespace std;

double DrivingCost(double drivenMiles, double milesPerGallon, double dollarsPerGallon)

{

  double dollarCost = 0;

  dollarCost = (dollarsPerGallon * drivenMiles) / milesPerGallon;

  return dollarCost;

}

int main()

{

  double miles = 0;

  double dollars = 0;

  cout << "Enter miles per Gallon   : ";

  cin >> miles;

  cout << "Enter dollars per Gallon: ";

  cin >> dollars;

  cout << fixed << setprecision(2);

  cout << endl;

  cout << "Gas cost for 10 miles : " << DrivingCost(10, miles, dollars) << endl;

  cout << "Gas cost for 50 miles : " <<DrivingCost(50, miles, dollars) << endl;

  cout << "Gas cost for 400 miles: "<<DrivingCost(400, miles, dollars) << endl;

  return 0;

}

Explanation:

  • Create a method definition of DrivingCost that accepts  three input double data type parameters drivenMiles,  milesPerGallon, and dollarsPerGallon and returns  the dollar cost to drive those miles .
  • Calculate total dollar cost and store in the variable, dollarCost .
  • Prompt and read the miles and dollars per gallon  as input from the user .
  • Call the DrivingCost function three times  for the output to the gas cost for 10 miles,  50 miles, and 400 miles.

 

You might be interested in
What finacial behaivor will typically lead to a low credit score
aksik [14]
Too much spending and lack of paying your other accounts.. Like {clothes. Cell phone contract}
8 0
3 years ago
The type of business organization that can continue indefinitely is known as a
Natasha2012 [34]
C. Corporation

Corporation- The type of business organization that can continue indefinitely
6 0
3 years ago
Select the correct answer.
Andru [333]

Answer:

OD Check for Internet issues

5 0
3 years ago
To be fluent in computer language you must learn 8000 __________? (9 letter word)
zheka24 [161]

Answer:

I believe its Algorithm

Explanation:

4 0
3 years ago
To change the print orientation from portrait to landscape, tap or click the ____ button on the print preview tab.
lianna [129]
<span>In certain instances, it makes sense to print documents in landscape orientation. Some examples include spreadsheets and tables, where the content within the document is wider than it is longer. If you print in portrait mode, it would cut off parts of the table or spreadsheet. In this case, you'll want to change the print settings to landscape. To change it to landscape, simply click the "landscape" button on the print preview tab.</span>
4 0
3 years ago
Other questions:
  • If you are asked to bring in agile way of working into the way a meeting runs, which one among the listed options will you imple
    11·1 answer
  • What can be used to describe and document the analysis and design of complex software systems?
    14·1 answer
  • Create a function that will concatenate two strings, combining them with a specified separator. To do so, write a function calle
    5·1 answer
  • A. True <br> b. False: variables represent storage locations in the computer's memory.
    13·1 answer
  • You can view information for the individual people who will perform the tasks on theproject in the
    7·1 answer
  • What table element represents a field within a record in powerpoint A column B Row C header D footer
    14·1 answer
  • HELP WILL GIVE BRAINLIEST
    5·1 answer
  • You have deployed a web application targeting a global audience across multiple Oracle Cloud Infrastructure (OCI) regions.
    10·1 answer
  • the following names are considered valid names for variable except for a. ST_Name b. ST name c. STName​
    9·1 answer
  • Please help me to creat flow chart tq​
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!