Question: Please use Python, Implement a class to represent driving a car on a trip. Most cars have a user-adjustable odomoter called a tripmeter that they
Please use Python,
Implement a class to represent driving a car on a trip. Most cars have a user-adjustable odomoter called a tripmeter that they can use to track arbitrary mileage. At the start of each trip, the tripmeter is set to 0. As the car is driven, your class should keep track of the miles driven.
startTrip(self) Sets the tripmeter to 0.
drive(self, mph, minutes) Drives at the given speed for the given amount of time.
tripmeter(self) Returns the mileage shown on the tripmeter.
Test your class by writing code to simulate several trips consisting of several segments at various speeds and distances
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
