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]
2 years ago
10

C++

Computers and Technology
2 answers:
egoroff_w [7]2 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]2 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
To lose weight, you must _______.
sweet [91]

Answer:

B

Explanation:

because you need to exercise and eat or drink less calories

8 0
2 years ago
Read 2 more answers
What tends to happen to the accuracy of our savings goals as our investment horizon becomes longer? A. It is not useful to have
liubo4ka [24]

Answer:

The answer is "Option B".

Explanation:

The Secured Goals are a part of your account, which is configured to just save your cash and also save it, and all the differences are good dividend savings accounts to shield this from accidental expenses. While opening the protected savings fund, the saving goal would be automatically created or loan rates invested only at the end of each month, that's why in this question "option B" is correct.

8 0
3 years ago
A reaction between an acid and a base is both a neutralization reaction and what other kind of reaction?
astraxan [27]
Hi!

The answer is C. Double replacement.

Have a nice day!
7 0
3 years ago
A mobile device user has entered her user ID and password to access an online account. The user immediately receives a text mess
tensa zangetsu [6.8K]

Answer:

A. Multifactor authentication

Explanation:

Multifactor authentication is a security system process that requires a user to verify his or her identity by providing two categories of credentials.

A mobile device user has entered her user ID and password to access an online account, she immediately receives a text message with a unique PIN or One Time Password (OTP) that must be entered before she is granted access to the account. This is an example of a multifactor authentication security method.

8 0
2 years ago
What are the three major functions of a game engine?
zzz [600]
Three major functions of a game engine would be Physics, Programming, and an audio engine should be some major functions of a game engine.
4 0
3 years ago
Other questions:
  • Consider the following method:
    8·2 answers
  • Does anyone know this ? this website is scratch btw.
    10·1 answer
  • What percentage of people with internet access use emojis?
    11·1 answer
  • ____ is the code of acceptable behaviors users should follow while on the internet; that is, it is the conduct expected of indiv
    10·1 answer
  • Why is plastic durable?
    9·2 answers
  • If we can lock a file, we can solve the race condition problem by locking a file during the check-and-use window, because no oth
    14·1 answer
  • One way to use contiguous allocation of the disk and not suffer from holes is to compact the disk every time a file is removed.
    13·1 answer
  • Need answer ASAP!!!!
    14·1 answer
  • What is microsoft excel​
    9·2 answers
  • Are tigers and goldfish related
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!