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
Pepsi [2]
4 years ago
10

Drivers are concerned with the mileage obtained by their automobiles. One driver has kept track of several tankfuls of gasoline

by recording miles driven and gallons used for each tankful. Develop a sentinel-controlled-repetition script that prompts the user to input the miles driven and gallons used for each tankful. The script should calculate and display the miles per gallon obtained for each tankful. After processing all input information, the script should calculate and display the combined miles per gallon obtained for all tankfuls (that is, total miles driven divided by total gallons used).
Enter the gallons used (-1 to end): 128
Enter the miles driven: 287 The miles/gallon for this tank was 22.421875
Enter the gallons used (-1 to end): 10.3
Enter the miles driven: 200 The miles/gallon for this tank was 19.417475
Enter the gallons used (-1 to end): 5
Enter the miles driven: 120 The miles/gallon for this tank was 24.000000
Enter the gallons used (-1 to end): -1 The overall average miles/gallon was 21. 601423
Computers and Technology
1 answer:
iVinArrow [24]4 years ago
4 0

Answer:

In Python:

gals= float(input("Enter the gallons used (-1 to end): "))

miles = float(input("Enter the miles driven: "))

mileage = 0.0

count = 0

while not (gals == -1):

   count += 1

   mileage +=(miles/gals)

   print("The miles/gallon for this tank was "+str(round(miles/gals,6)))

   gals= float(input("Enter the gallons used (-1 to end): "))

   miles = float(input("Enter the miles driven: "))

print("The overall average miles/gallon was "+str(round(mileage/count,6)))

Explanation:

#This prompts the user for the number of gallons used

gals= float(input("Enter the gallons used (-1 to end): "))

#This prompts the user for miles driven

miles = float(input("Miles driven: "))

#This initializes the mileage to 0

mileage = 0.0

#This initializes the count of vehicles to 0

count = 0

#The following is repeated until input for gallons is -1

while not (gals == -1):

#The count of vehicles is increased by 1

   count += 1

#The total mileage for all cars is calculated

   mileage +=(miles/gals)

#This prints the mileage for that particular vehicle

   print("The miles/gallon for this tank was "+str(round(miles/gals,6)))

#This prompts the user for the number of gallons used

   gals= float(input("Enter the gallons used (-1 to end): "))

#This prompts the user for miles driven

   miles = float(input("Miles driven: "))

#This calculates and prints the overall average mileage  

print("The overall average miles/gallon was "+str(round(mileage/count,6)))

You might be interested in
Jonathan is eight years old and is a participant in a study assessing the eating habits of schoolchildren. To assess the childre
Law Incorporation [45]

Answer:

"The research team is taking measurements of Jonathan's height and weight to assess his growth"

Explanation:

Anthropometric data refers to a mass of collected information regarding an individual's different measurements such as height, weight, BMI, etc. Therefore the best way to explain this data collection method to the parents in this scenario would be to say that "The research team is taking measurements of Jonathan's height and weight to assess his growth"

7 0
4 years ago
The ________________ command ends the current command session
Lemur [1.5K]

Answer:

exit

Explanation:

When the Command Prompt window is active, you can end a Command Prompt session in any of the following ways: Type exit at the command prompt. Click the Close button. Click the Control menu icon, and choose Close.

5 0
4 years ago
Read 2 more answers
When you respond to an e-mail message, a good skill to develop is ___________-editing, which involves inserting your responses t
Drupady [299]

Answer: Down editing

Explanation:

Down editing is a method of replying emails which allows you to respond point by point to an email. It add certainty, precision and quality to your response and helps prevent misunderstanding of email response.

7 0
3 years ago
What are the two features of EDIAC ?​
Sergio [31]

Answer:

By the numbers: “The ENIAC contained 17,468 vacuum tubes, along with 70,000 resistors, 10,000 capacitors, 1,500 relays, 6,000 manual switches and 5 million soldered joints. It covered 1,800 square feet (167 square meters) of floor space, weighed 30 tons, consumed 160 kilowatts of electrical power.” More info

3 0
3 years ago
Which type of visual aid should students use to track small changes over time?
xenn [34]
Line graphs are used to graph change in time
7 0
3 years ago
Read 2 more answers
Other questions:
  • Describe in detail how to determine if a source is credible when conducting research. Justify your response using two or more co
    8·1 answer
  • A water-sports company specializes in custom-made watercrafts and accessories.Their marketing manager decides to use the broad-m
    12·1 answer
  • What is the specifications, number of sales, positive and negative points and a few popular games of the first PlayStation?
    13·1 answer
  • A teacher determines student percentages in a course as the points a student earns divided by the total points available in the
    9·1 answer
  • URGENT HELP PLEASE
    13·1 answer
  • Your manager has requested you keep a timesheet showing how many hours you work each day and what projects you work on during th
    13·2 answers
  • What internal commands can we use when in interactive mode? can we use CLS and CD?
    6·1 answer
  • Create a function called biggestNum that returns the largest number in an array of integers. The function is passed only one par
    12·1 answer
  • A central issue of public sharing is:
    13·2 answers
  • What aspect should you consider before adding pictures to a document? You should structure the first before you search for a rel
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!