Hit The Road Script Name: roadTrip Script Outputs (1): cost (double) the cost of
ID: 3636778 • Letter: H
Question
Hit The Road Script Name: roadTrip Script Outputs (1): cost (double) the cost of the amount of gas needed for the road trip Script Description: Write a script named "roadTrip" that uses the number of miles a car can travel with a specified number of gallons of gas, as well as the length of a road trip and the price of gas per gallon and calculates the cost of the amount of gas needed for the trip. Name your final output variable "cost". Notes: - Again, you do not have to account for rounding to the nearest penny. Inputs: - tank size = 5.12 gallons distance traveled in one tank = 155.36 miles total distance of trip - 350 miles price per gallon = $3.84 Outputs: cost rightarrow 44.2925Explanation / Answer
Code: %could also possibly get input as x y .. x = input('Enter the Tank size value %d'); y = input('Enter the distance per tank%.1d : '); p = input('Enter the total distance %d'); q = input('Enter price per gallon%.1d : '); cost = (p/y) *x*q; print(cost); end
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.