Question

7. Miles-per-Gallon 6pts A car’s miles-per-gallon (MPG) can be calculated with the following formula: MPG =...

7. Miles-per-Gallon 6pts A car’s miles-per-gallon (MPG) can be calculated with the following formula: MPG = Miles driven / Gallons of gas used Design a program that asks the user for the number of miles driven and the gallons of gas used. It should calculate the car’s miles-per-gallon and display the result on the screen.Draw a flowchart in algorithmic language

0 0
Add a comment Improve this question Transcribed image text
Answer #1


#python program that prompts user
#to enter miles and gallons ,then
#the program calculates the miles per gallon
#display the result on console.

miles=float(input("Enter number of miles :"))
gallons=float(input("Enter number of gallons :"))
milespergallon=miles/gallons
print("Miles per gallon : ",milespergallon)

---------------------------------------------------------------------

Sample Output:

Enter number of miles :10
Enter number of gallons :5
Miles per gallon : 2.0

---------------------------------------------------------------------

Flow chart:Miles per Gallon

Add a comment
Know the answer?
Add Answer to:
7. Miles-per-Gallon 6pts A car’s miles-per-gallon (MPG) can be calculated with the following formula: MPG =...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Classwork 2-2: Input & Formatting A car's miles-per-gallon (MPG) can be calculated using the formula: MPG...

    Classwork 2-2: Input & Formatting A car's miles-per-gallon (MPG) can be calculated using the formula: MPG - miles driven/gallons of gas used Write a program that asks the user for the car's make, number of miles driven and the gallons of gas used. It should calculate the car's MPG and displays the result rounded to 2 decimal places. Example "Your Honda's MPG is 28.56" On Blackboard, submit a screenshot of successfully running and testing your code on HackerRank.com: www.hackerrank.com/csc124-chapter-2-classwork (2nd...

  • I need trying to figure out how I can make create a code in Python with this exercise for I am having trouble doing so. Miles Per Gallon Calculator Write a GUI program that calculates a car's gas...

    I need trying to figure out how I can make create a code in Python with this exercise for I am having trouble doing so. Miles Per Gallon Calculator Write a GUI program that calculates a car's gas mileage. The program's window should have Entry widgets that let the user enter the number of gallons of gas the car holds, and the number of miles it can be driven on a full tank. When a Calculate MPG button is clicked,...

  • create an application in VISUAL BASIC that calculates a cars gas mileage. The formula for calculating...

    create an application in VISUAL BASIC that calculates a cars gas mileage. The formula for calculating the miles that a car can travel per gallon of gas is MPG = Miles/Gallon In the formula MPG is miles-per-gallon, miles is the number of miles that can be driven on a full tank of gas, and gallons is the number of gallons that the tank holds. The applications form should have TextBox controls that let the user enter the number of gallons...

  • Hi, Hi, I need someone to write a program in Phython 3.6, and please I will...

    Hi, Hi, I need someone to write a program in Phython 3.6, and please I will appreciate if the code is error free and indented correctly. The output would be preferable. thanks Write a GUI program that translates the Latin words to English. The window should have three buttons, one for each Latin word. When the user clicks a button, the program displays the English translation in a label. 3. Miles Per Gallon Calculator Write a GUI program that calculates...

  • The fuel efficiency (miles per gallon (MPG)) of a Chevrolet Camaro driven on a highway can...

    The fuel efficiency (miles per gallon (MPG)) of a Chevrolet Camaro driven on a highway can be calculated with the following formula, FE = 71.7 * s * (2 + 0.0192 * s) (-4.5) + e(-5.1*s)

  • Its an app) (Miles-per-Gallon Calculator App) In java with comments Place AnchorPane in design and set...

    Its an app) (Miles-per-Gallon Calculator App) In java with comments Place AnchorPane in design and set its attributes Place mileTextField, gallonsTextField and calcButton on the AnchorPane and set their attributes Place label that will show the calculated value and set its attributes Drivers often want to know the miles per gallon their cars get so they can estimate gasoline costs. Develop an app that allows the user to input the number of miles driven and the number of gallons used...

  • Drivers are concerned with the mileage their automobiles get. One driver has kept track of several...

    Drivers are concerned with the mileage their automobiles get. One driver has kept track of several tankfuls of gasoline by recording the miles driven and gallons used for each tankful. Develop a C# app that will input the miles driven and gallons used (both as integers) for each tankful. The app should calculate and display the miles per gallon obtained for each tankful and display the combined miles per gallon obtained for all tankfuls up to this point. All averaging...

  • Compute for Miles Per Gallon in C++

    Make a program that will calculate and compute for the quotient of miles and gallons (mpg: miles per gallons). Your program should must ask the user to specify the size of the array (using dynamic array) for the following variable: miles ,gallons and mpg. Prompt the user to Initialize  the value of miles (value for miles should be 100-250) and gallons (values should be from 5-25). Use pointer galPtr for gallons, milPtr for miles and mpgPtr for mpg.  Use function...

  • Your car gets 25 miles per gallon (mpg at 60 miles per hour (mph) and 18...

    Your car gets 25 miles per gallon (mpg at 60 miles per hour (mph) and 18 mpg at 70 mph At what speed should you make a 600-mile trip: a. If gas costs $3 per gallon and your time is worth S12 per hour? b. If gas costs S4 per gallon and your time is worth $15 per hour? allon and your time is worth S10 per hour? d. Build a spreadsheet to calculate the total trip cost for gas...

  • Your used Chevy's gas mileage (in miles per gallon (mpg) is given as a function M...

    Your used Chevy's gas mileage (in miles per gallon (mpg) is given as a function M (x) of speed in miles per hour (mph), where M(1) - 2000 Calculate M' (40), M' (50) and M' (60) rounded to two decimal places M' (40) = mpg/mph M' (50) = mpg/mph M' (60) = mpg/mph

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT