Question
In this lab, youll be using python and building a tool to allow people to compare their vehicles. So, basically, assume a family has two
In this lab, youll be using python and building a tool to allow people to compare their vehicles. So, basically, assume a family has two vehicles theyre able to use and theyre trying to decide which vehicle would be best to use on a road trip. Your job is to create a program that takes in the names (make, model, year) of two vehicles and their gas mileage and tank capacity. You should then ask the user how many miles their trip is supposed to be and calculate how many tanks of gas it would take for each vehicle. Finally, you should get an average gas price (for instance, $1.99 per gallon) and list how much that particular vehicle would cost. Finally, your program should display the information in a clean, formatted way. It should resemble a table of some sort. Have a header and each column a set width. Heres what mine are in my code: Car - width of 30 spaces Tanks - width of 10 spaces (left aligned) Cost - this one doesnt matter so much since its the last column (I didnt format that to any specific number of spaces) You can assume the values wont cause it to go over the set number of spaces. Notes: When calculating how many tanks of gas is needed, youll need to round up. So, if your vehicle takes 3.4 tanks, your program should print that itll need 4 tanks. Also, make sure youre formatting your costs to two decimal points and include a dollar sign (directly next to it). A price of $2.40 should not read $ 2.4. Additionally, your price should be based on how much it is to fill up a full tank on each individual vehicle. You shouldnt just calculate how many gallons that car would need and then calculate that cost.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started