Can someone assist me on creating this program? Thank you.


create a program that will allow you to calculate the following:


1) The average gas mileage of a car
2) The range of a given car
3) The cost of a given trip


1) Create a Car.py file that will include the following methods:
a. calcMileage(range,gasUsed)
b. range(range,gasUsed)
c. cost(tripLength,averageMPG,priceOfGas)
2) Create an EnterInfo.py file that will import the Car.py file and prompt the user to enter the information and perform the given task. This can be modeled from the previous assignment.
3) You will have to include try and exception blocks that will allow users to enter floats and handle any bad user input.

Recommended Answers

All 3 Replies

See this quote on the main page " We only give homework help to those who show effort"

In other words: what have you tried so far?

Yeah, the best approach is to post code (or even pseudo-code) and then we can refer to line numbers.

Technically, the objects 'calcMileage', 'range', and 'cost' in the car.py module will be functions rather than methods.

Anyways, show us what you got and we can go from there.

Jeff

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.