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
denis23 [38]
3 years ago
15

2.13 LAB: Driving costs Driving is expensive. Write a program with a car's miles/gallon and gas dollars/gallon (both floats) as

input, and output the gas 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 as follows: print('{:.2f} {:.2f} {:.2f}'.format(your_value1, your_value2, your_value3)) Ex: If the input is: 20.0
Engineering
2 answers:
SOVA2 [1]3 years ago
4 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:

hichkok12 [17]3 years ago
3 0

Answer:

The code for this question will be:

#include <iostream>

using namespace std;

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

 

 double dollarCost = 0;

 dollarCost = (dollarsPerGallon * drivenMiles) / milesPerGallon; //calculates total cost

 

 return dollarCost;

}

int main() {

  double mileGallon = 0;

  double dollarGallon = 0;

  cin >> mileGallon;

  cin >> dollarGallon;

 

  cout << DrivingCost(10, mileGallon, dollarGallon) << " ";

  cout << DrivingCost(50, mileGallon, dollarGallon) << " ";

  cout << DrivingCost(400, mileGallon, dollarGallon) << endl;

   

  return 0;

}

You might be interested in
Which statement describes the wave pattern of a high pitch
olga55 [171]

Answer:

I hope this helps the tops of the waves are close together

8 0
3 years ago
Three spheres are subjected to a hydraulic stress. The pressure on spheres 1 and 2 is the same, and they are made of the same ma
r-ruslan [8.4K]

Answer:

"150000 N/m²" is the right approach.

Explanation:

According to the question, the pressure on the two spheres 1 and 2 is same.

Sphere 1 and 2:

Then,

⇒  P_1=P_2

⇒  \frac{\Delta V_1}{V_1}=\frac{\Delta V_2}{V_2}

and the bulk modulus be,

⇒  B_1=B_2

Sphere 3:

⇒  \frac{\Delta V_3}{V_3} =\frac{\frac{\Delta V_1}{V_1} }{\frac{\Delta V_2}{V_2} } =1

then,

⇒  P_3=B\times \frac{\Delta V_3}{V_3}

⇒       =B\times 1

⇒       =150000\times 1

⇒       =150000 \ N/m^2

5 0
3 years ago
I am standing on the upper deck of the football stadium. I have an egg in my hand. I am going to drop it and you are going to tr
Alina [70]

Answer:

Δx = 25 ft.

Explanation:

Assuming that the person on the ground starts running at the same time as the egg is dropped, we have two simultaneous trajectories:

1 ) Egg falling:

If the egg is dropped, and we neglect the air resistance, we can use the kinematic equation that relates the distance and fall time, as follows:

yf-y₀ = 1/2* g* t²

If we take the up direction as positive, we can solve for t as follows:

0-100 ft = 1/2* (-32.15 ft/s²)* t²

⇒ t = \sqrt{(100*2)/32.15} = 2.5 sec.

2) Person on the ground running away:

In order to be able to run away, and then return to catch the egg, running at constant speed, he must run during exactly the half of the time that the egg is falling, i.e., 1.25 sec.

We can get the distance at which he can reach, applying the definition of velocity:

v = (xf-x₀) / (tfi-t₀)

If we choose t₀=0 and x₀ = 0 , we can solve for xf, as follows:

xf = v*t = 20 ft/sec*1.25 sec = 25 ft.

8 0
3 years ago
Were is carbon monoxide located in a car
Semenov [28]

Answer:

all exhaust gases from all gasoline engines

Explanation:

if u look at the back of ur car when its on u can feel the heat from the exhaust and whT ur feeling is the heat coming from the carbon monoxide gases

6 0
4 years ago
Read 2 more answers
Assume you are an observer standing at a point
Arlecino [84]

Answer:

3.1m

Explanation:

6 0
3 years ago
Other questions:
  • Can you tell me important facts about Peggy A. Whitson?
    5·1 answer
  • An engine indicator is used to determine the following: (a) speed (d) m.e.p, and IHP (e) BHP (b) temperature (c) volume of cylin
    7·1 answer
  • 5.46 By supplying energy at an average rate of 24,000 kJ/h, a heat pump maintains the temperature of a dwelling at 20°C. If elec
    9·1 answer
  • Given a series of numbers as input, add them up until the input is 10 and print the total. Do not add the final 10. For example,
    7·1 answer
  • Two synchronous motors having subtransient reactances of 0.8 and 0.25 p.u., respectively, on a base of 500 V 2 MVA are connected
    13·1 answer
  • we wish to send at a rate of 10Mbits/s over a passband channel. Assuming that an excess bandwidth of 50% is used, how much bandw
    15·1 answer
  • Please help <br>.. <br>....<br> . .<br>....<br>...​
    13·1 answer
  • A fill covering a wide area is to be placed at the surface of this profile. The fill has a total unit weight of 20 kN/m^3 and is
    11·1 answer
  • 1 point
    6·1 answer
  • Identify the prefixes used in the International System of
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!