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]
2 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]2 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]2 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
"Consideration of being digitally" literate Means to produce digital technology Participate in digital activities none of the ch
masha68 [24]

Answer:

Participate in digital activities.

Explanation:

Digital literacy is a concept that describes the ability of writing, messaging, designing graphics, socialisation etc, with or through a digital device platform.

It's principles are based on discipline like social sciences, computer literacy, visual literacy and many more.

A digital literate is an individual that can interact with digital platforms to write, design graphics, socialize, create videos and audio and creatr other types of digital documents.

8 0
3 years ago
To maintain her audience's confidence in her, what should kiara not do while delivering her presentation?
IrinaVladis [17]
Use filler words like ummmm, like, so, kinda, or such. Faltering on her words, forgetting things, or not saying things with confidence wouldn't help either. Also, do not loose eye contact with the people even if you only occasionally look up, it makes you look nervous and like you don't know what you're talking about.
7 0
3 years ago
DO NOT ANSWER FOR JUST POINTS
Elza [17]

Answer:

E.

a medium dashed line

Explanation:

I always use medium hehe so I think that'll work.

5 0
2 years ago
Read 2 more answers
software that instructs the computer how to run applications and controls the display/keyboard is know as the___.
kakasveta [241]
The answer is the alu arithmetic logic unit.
8 0
3 years ago
In a non-formatted/standard template, if the number 25 is converted to text format, the
goldfiish [28.3K]
<h2>The alignment of the text will be "left" by default</h2>

Explanation:

  • In Excel or spreadsheet, if any number is entered, it will automatically be aligned to right because right alignment is preferable for the numbers.
  • In case of any alignment is mentioned in the cell in prior to entering text or if the type of data is changed after or before entering the text, then the text is aligned accordingly.
  • According to the given scenario, a number "25" is entered and it is converted to text. So a text format will preserve the alignment as entered. By default it will be "left" aligned.

3 0
2 years ago
Other questions:
  • A base class named Garden contains a private field width and a property public int Width that contains get and set accessors. A
    11·1 answer
  • Which command can be used to manually add a package to the driver store?
    13·1 answer
  • Does YouTube have the potential to change academia as we know it, or is that a bit of a stretch? Explain.
    9·2 answers
  • Select the recommended design practice that applies to a web site using images for main site navigation.
    7·1 answer
  • What type of network is capable of delivering voice, video streams, text, and graphics between many different types of devices o
    15·1 answer
  • What are some benefits of 3-D printing?
    9·1 answer
  • If a fire should break out in your building, which of the following actions is NOT recommended?
    10·2 answers
  • Use the drop-down tool to select the word or phrase that completes each sentence.
    7·1 answer
  • Every single device can be connected to every other device on network, making the network mesh. This statement is True or False?
    8·1 answer
  • File names should be limited to 144 characters.<br><br> true or false
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!