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
Write a program to test if an integer input from the keyboard is odd or even. Sample Run 1: Enter a Number: 78 Even Sample Run 2
liq [111]

Answer:

number = int(input("Enter a number: "))

if number % 2 == 0:

   print("Even")

else:

   print("Odd")

Explanation:

Currently taking python at school. On the last few lessons.

7 0
3 years ago
I live in Pennsylvania which observes eastern standard time.
goldfiish [28.3K]

Answer:

mudar o horário de acordo com a vista

Explanation:

4 0
3 years ago
Which is the process that a wireless router uses to translate a private ip address on internal traffic to a routable address for
luda_lava [24]
<span>The process that a wireless router uses to translate a private ip address on internal traffic to a routable address for the internet is </span>Network address translation<span> (NAT).  It is a method of relabeling one </span>IP address<span> space into another by altering network </span>address<span> information in IP header of packets while they are in transit across a </span>traffic routing<span> device. </span>
7 0
3 years ago
Why are men more exposed to mass media?
adell [148]

Answer:

because they like exploring

8 0
2 years ago
Read 2 more answers
Given the char variable c, write an expression that is true if and only if the value of c is not the space character .
saw5 [17]
If( c != ' ' )
  /*Do something*/
6 0
3 years ago
Other questions:
  • Assume you have a project with seven activities labeled A-G (following). Derive the earliest completion time (or early finish-EF
    15·1 answer
  • What are the main differences between a workgroup and a domain?
    14·2 answers
  • The syntax used for referencing cells with their worksheet names is the sheet name, followed by ____, then the usual column lett
    8·1 answer
  • Write a function addOne that adds 1 to its integer referenceparameter. The function returns nothing.
    11·1 answer
  • Going to Grad School! In the College of Computing and Software Engineering, we have an option for students to "FastTrack" their
    11·1 answer
  • The Cursor is blinking in a white area on the Screen. This area where text will appear in the ____.
    10·2 answers
  • Using PowerPoint or Impressed guarantees that your presentation will do which of the following?
    6·1 answer
  • Customizing ads to people who had earlier visited the site is
    14·1 answer
  • What makes these Pokémon special?
    9·2 answers
  • A. Get a value for x from the user.
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!