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
olga nikolaevna [1]
3 years ago
14

2.27 LAB: Driving costs Driving is expensive. Write a program with a car's miles/gallon and gas dollars/gallon (both doubles) 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: System.out.printf("%.2f", yourValue);
Computers and Technology
2 answers:
exis [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:

leonid [27]3 years ago
3 0

Answer:

<em>Java</em>

//////////////////////////////////////////////////////////////////////////

import java.util.Scanner;

public class MyClass {

   public static void main(String args[]) {

     double miles_gallon, gas_gallon;

     ////////////////////////////////////////////////

     System.out.print("Enter miles per gallon: ");

     Scanner myObj = new Scanner(System.in);

     miles_gallon = myObj.nextDouble();

     

     System.out.print("Enter gas dollars per gallon: ");

     gas_gallon = myObj.nextDouble();

     

     System.out.println();

     ////////////////////////////////////////////////

     double twenty_miles = 20/miles_gallon*gas_gallon;

     System.out.printf("Gas cost for 20 miles: $%.2f%n%n", twenty_miles);

     

     double seventy_five_miles = 75/miles_gallon*gas_gallon;

     System.out.printf("Gas cost for 75 miles: $%.2f%n%n", seventy_five_miles);

     

     double five_hundered_miles = 500/miles_gallon*gas_gallon;

     System.out.printf("Gas cost for 500 miles: $%.2f", five_hundered_miles);

   }

}

You might be interested in
True or False: Unity can apply multiple textures to a single object or terrain
MaRussiya [10]
This is very true unity is what u said and it is the definition of this
3 0
3 years ago
Which of the following is not a true statement about Christopher Columbus it oko
Thepotemich [5.8K]

Answer:

  • There has been a need to explore the different regions across the globe in the early ages, as there were ships to travel but there was no one before who knew about the different routes and maps of the region, so, it was sort of blind folded traveling when some one wanted to go far distances yet some of them knew about other regions on the far sides of many seas having a unique culture, different languages, along with having diversity among the flora and fauna inside the region.
  • So, like many other curious people across the globe there was a need for the people to explore all the regions. As, it was a need for the travelers and all the rest of free fork to know about this world. Now, every wanted to know more about the different lands but there were few who even performed the great feat, as they had fear for their lives.While, Christopher Columbus was more into sacrificing his own life in order to explore the lands at the far lands across the Pacific ocean. As, he arranged his mind and covered all the required arrangements for the journey.
  • As, was at first wanted to explore the lands of far east and thus wanted to more about the Subcontinent India, but in turn he reached the lands of the American continent in far west.While, upon arriving the American region we say many people with different skin tone, culture and language which was very different then he heard about the people of India.There was more different world then he could ever think of as he had a lot to tell about these lands upon the way back to Europe or his home land.

7 0
3 years ago
Jensen is a senior developer for Hackers R'Us, a company that helps secure management information systems. Jensen's new task is
Harlamova29_29 [7]

Answer:

b. white-hat hacker

Explanation:

A White-hat Hacker, also known as an Ethical Hacker is an information security specialist, known for performing penetration testing and checks in search for information and communications system's vulnerabilities on demand for his/her clients.

These efforts are meant to find security risks before someone else does, who could cause any kind of damage to the systems or unauthorized access to sensitive information

6 0
3 years ago
Where is Peru located?
Illusion [34]
B. South America

[ignore:20 CHARACTERS]
4 0
3 years ago
It is a good idea to include your teacher’s name on a title page.
LenaWriter [7]

Answer: I think it all depends on the teacher because I know one of my teachers like when we put their name on our assignments. So I pick true

Explanation:

6 0
3 years ago
Read 2 more answers
Other questions:
  • Edward has started up a new company with his friend, Matthew. Currently, he has only two people working with him. Which type of
    8·1 answer
  • A/An is a series of instructions or commands that a computer follows; used to create software
    10·2 answers
  • A powerful computer that acts as a hub for other computers is a called a ______.
    6·2 answers
  • _____ is used to temporarily hold small units of program instructions and data immediately before, during, and after execution b
    10·1 answer
  • Which term refers to the blank areas surrounding a document page? *
    15·1 answer
  • When pointed over a text within a paragraph, the cursor takes the shape of a/an
    10·1 answer
  • AYUDAAAA!!!!! URGENTE!!!!!!1<br> ¿para que sirve la "BIG DATA"?
    9·1 answer
  • What is python, the coding language
    6·2 answers
  • How to determine the critical crack size for a<br> plate
    15·1 answer
  • You are part of the team assigned to implement new software at XYZ Inc. The employees at XYZ Inc. trust the results obtained fro
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!