Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Python Help Scenario You will create world with cities, trains, and exciting journeys! This will require some proscribed class definitions. Create all the classes as
Python Help
Scenario You will create world with cities, trains, and exciting journeys! This will require some proscribed class definitions. Create all the classes as defined below, all in your single .py file. Some of the classes build upon each other this is an example of aggregation. Many of the methods required below are very regular after you've seen one init method on this program, you've sort of seen them all. While there might be a bit more typing than usual, the amount of mental work to "solve the puzzle" should be a bit minimal once you get used to the patterns. Classes You will be writing four classes (Train, City, Journey, and TraincapacityException). Make sure you understand what these represent and how they relate to each other before continuing Train class Instance variables string the name of the train name max passengers int the maximum number of passengers the train can transport num passengers int the number of passengers currently on the train int how fast the train travels (in feet per second) speed fps Methods init (self, name, max passengers, speed fps) constructor, initializes all instance variables num passengers should default to 0 when a train is created with the constructor. o Assumptions: speed fps and max-passengers will always be a non-negative number name will be a non-empty stringStep 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