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
Burka [1]
3 years ago
7

Driving is expensive. Write a program with a car's miles/gallon and gas dollars/gallon (both doubles) as input, and output the g

as 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: System.out.printf("%.2f", yourValue); The output ends with a newline.
Computers and Technology
2 answers:
Tatiana [17]3 years ago
4 0

Answer:

const double gasDollarPerGallon = 20 ;

float calCost( double milesPerGallon ) {

   double costPerGallon = milesPerGallon / gasDollarPerGallon;

   System.out.printf ("%.2f/n", &costPerGallon);

int main ( ) {

   scanf ("%2f", &gasDollarPerGallon) ;

   calCost( 20 );

   calCost( 75 );

   calCost( 500 );

Explanation:

The C source code above gets the user input of the gas dollar per gallon from the command prompt and divides the miles per gallon variable in the function call to get the cost of gas for the range of miles. It is also print out as a double with two places.

kiruha [24]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:

You might be interested in
I need the full code for 6.1.3 code hs circles and squares please answer please help
Sloan [31]

In this exercise we have to use the knowledge in computational language in python  to write a code with circles and squares.

<h3>how to draw geometric figures in python?</h3>

<em>inputs = 100</em>

<em>radius</em>

<em>    draw_circle(radius);</em>

<em>    pendown()</em>

<em>    begin_fill()</em>

<em>    circle(radius)</em>

<em>    end_fill()</em>

<em>    penup()</em>

<em>left(90)</em>

<em>forward(radius*2)</em>

<em>right(90)  </em>

<em>penup()</em>

<em>setposition(0,-200)</em>

<em>color("gray")</em>

<em>bottom_radius = int(input("What should the radius of the bottom circle be?: "))</em>

<em>draw_circle(bottom_radius)</em>

<em>draw_circle(bottom_radius)</em>

See more about python at brainly.com/question/18502436

7 0
2 years ago
WILL GIVE A BRAINLIEST!!! PLS HELP!!!
DIA [1.3K]

Answer:

never gonna give you uppp

Explanation:

criiiiii

7 0
3 years ago
Kevin would like to ensure that his software runs on a platform that is able to expand and contract as needs change. Which one o
Reil [10]

A terminology which best describe Kevin's goal in terms of expansion and contraction as needs change is: A. Scalability.

<h3>What is scalability?</h3>

Scalability can be defined as a measure of the ability of a system to change (expansion or contraction) in performance and cost as a result of changes in demands of application and system processing, especially in a network architecture.

In this context, we can logically deduce that a terminology which best describe Kevin's goal in terms of expansion and contraction as needs change is scalability.

Read more on scalability here: brainly.com/question/14301721

#SPJ1

Complete Question:

Kevin would like to ensure that his software runs on a platform that is able to expand and contract as needs change.  Which one of the following terms best describes his goal? A. Scalability B. Elasticity C. Cost effectiveness D. Agility

8 0
1 year ago
Is a class of software used to meet organization-wide business needs and typically shares data with other enterprise application
yuradex [85]

Answer:enterprise

Explanation:

5 0
1 year ago
Read 2 more answers
Revenue xls en excel
igor_vitrenko [27]
Whast does this mean

5 0
3 years ago
Other questions:
  • Which of the following is true about REST?
    12·1 answer
  • Outsourcing is an alternative systems building approach that may involve subscribing to an application service provider or hirin
    8·1 answer
  • OSHA's mission is to: A. Ensure that all workers receive adequate workers' compensation payments B. Esnure that all workers rece
    8·2 answers
  • A law office has been leasing dark fiber from a local telecommunications company to connect a remote office to company headquart
    14·1 answer
  • In the __________ Standard, chemical manufacturers, importers, and distributors are required to provide hazard information by wa
    10·1 answer
  • Liquid-liquid extraction is best suited to separate a mixture of compounds when:
    9·1 answer
  • Genetics Vocabulary: no <br> Allele: Different versions of the same qene (Aa, Bb)
    11·1 answer
  • What is professional education? <br><br><br><br><br>Please help me to do this.​
    7·2 answers
  • What is a database and provide 2 examples of how you are using a database.
    5·1 answer
  • The Internet is a worldwide communications network. Which device connects computer networks and computer facilities?
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!