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
When completing an application what color ink do you use
tankabanditka [31]

Black or blue pen would be appropriate.

5 0
3 years ago
Read 2 more answers
Most networking media send data using _____ in which data is represented by only two discrete states: 0s and 1s.
dlinn [17]

Answer:

i think digital signals

Explanation:

A digital signal is a signal that is being used to represent data as a sequence of discrete values; at any given time it can only take on one of a finite number of values.[1][2][3] This contrasts with an analog signal, which represents continuous values; at any given time it represents a real number within a continuous range of values.

6 0
3 years ago
Read 2 more answers
What is the proper way to name the range of cells located in colum A row 3 through colum C row 7?
LenKa [72]

Answer:

it is C

Explanation:

6 0
3 years ago
Read 2 more answers
A typical pda includes a(n) _____.
Ratling [72]
A.External Monitor.Hope I helped.
5 0
3 years ago
Read 2 more answers
Knowledge management software helps companies preserve the knowledge gained through the use of information so that future users
V125BC [204]

Answer:True

Explanation:

Knowledge Management (KM) software is software that assists with the identification, creation, distribution, and organization of a company’s knowledge pool. KM software, at its best, gives a company a single, unified pool of information that is easily

(1) accessible

(2) discoverable

(3) updated

KM software is meant to make companies leaner, efficient, and more profitable. But a number of challenges exist which make that easier said than done. Let’s look at a few of the primary challenges that make KM software so important for businesses—but so difficult to get right.

8 0
2 years ago
Read 2 more answers
Other questions:
  • Skinner designed a soundproof apparatus, often equipped with a lever or bar, with which he conducted his experiments in operant
    9·1 answer
  • ​What file system below does not support encryption, file based compression, and disk quotas, but does support extremely large v
    10·1 answer
  • A person painting his house dumps the unused paint on the ground. Which of the following resources will this most likely pollute
    14·1 answer
  • List 5 different programming languages calls to print
    8·2 answers
  • Sophie Black works as a computer programmer for a software company. Her boss, Mike Jones, is responsible for developing a new so
    8·1 answer
  • Where in an email would u find information about the action requirements​
    9·1 answer
  • What is the correct name for the words Home, Insert, Design, Layout, References, etc. in the ribbon in Word 2016?
    8·2 answers
  • Express 0.0005 x 10-4 farads as picofarads
    5·2 answers
  • What is the next line?
    7·1 answer
  • Hello everyone. New ppl on Ro.blox? I want to play sometime.
    8·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!