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
Suppose you are an ad-serving company and you maintain a log of cookie data for ads you serve to the Web pages for a particular
Firlakuza [10]

Answer:

A

Explanation:

thethe more you have attached the more people are going to know your product so that it's going to be a long process which people can introduce to their friends

3 0
2 years ago
The term ________________ denotes data that is being stored on devices like a universal serial bus (USB) thumb drive, laptop, se
Vinvika [58]

Answer:

The term "Local storage"denotes data that is being stored on devices like a universal serial bus (USB) thumb drive, laptop, server, DVD, CD, or server. The term "hosted storage," "Internet storage" or "cloud storage." denotes data that exists in a mobile state on the network, such as data on the Internet, wireless networks, or a private network

4 0
3 years ago
Read 2 more answers
The limit for characters in modern file systems is too small to accommodate keywords in titles
Nata [24]
The limit for file names on modern file systems is usually at least 255 bytes.
3 0
3 years ago
Read 2 more answers
A series of inventions led to the creation of the electronic digital computer shortly after this war..
lesantik [10]
What is world war 2? bob
4 0
3 years ago
Which font attribute would be most appropriate to make a papers heading stand out?
eimsori [14]

If you want your heading to pop out I would go for bold Becuase it shows the letters darker and bigger which would make the heading the center of attention.

7 0
3 years ago
Read 2 more answers
Other questions:
  • What would happen to a eukaryotic cell if all its mitochondriawere destroyed
    7·1 answer
  • A ____ is a collection of computers and users that are identified by a common security database. workgroup controller segment do
    7·1 answer
  • What are the different between Facebook and LinkedIn
    15·2 answers
  • Please conduct some research and find an article on Security Threats and please provide link of the article.
    5·1 answer
  • 5. RAM IS YOUR SYSTEM’S-
    14·2 answers
  • Write an expression that executes the loop while the user enters a number greater than or equal to 0.
    10·1 answer
  • Which job role requires you to create user guides for computer products and services?
    13·2 answers
  • Your worksheet has the value 27 in cell B3. What value is<br>returned by the function =MOD(B3,6)?​
    8·1 answer
  • Remember partially filled arrays where the number of elements stored in the array can be less than its capacity (the maximum num
    14·1 answer
  • ____ returns the maximum number of elements that can be inserted into the vector container vecCont without reallocation.
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!