Menu

[Solved]Unload People Self Nunpeople Attempts Remove Nun People Bus Number People Supplied Larger Q37283356

python help please. Cannot import anything except math* . unload people(self, nun_people)::Attempts to remove nun people from the bus. If the number of people supplied is larger t

* . unload people(self, nun_people)::Attempts to remove nun people from the bus. If the number of people supplied is larger than the number of people on the bus currently, return False and do not change the number of people currently on the bus. [You may imagine this as “the people are so confused by the request that they just stay where they are looking confused”] Classes Many of the methods required below are very regular- after youve 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. You will be writing four classes (Bus, Town, and Journey). Make sure you understand what these represent and how they relate to each other before continuing. Note and Assumptions: ‘ You can assume that num people is always a non-negative integer. This function should return True if the people were unloaded from the bus. Town class: Bus class: Instance variables Instance variables: # te nan, of thg town : stnng int int int string # the name of the bus # the naxínum number of people the bus can transport i the number of people currently on the bus # how fast the bus travels (in feet per second) loc x the town’s x location (in an x-y-coordinate system) # the town’s y location (in an x-y-coordinate system) # how long (in number of seconds) buss stop in this town :int max_people e nun people 1oc int stop tine . speed fps Methods: Methods: init (self, name, loc x, loc y, stop tine) constructor, initializes all instance variables. Assumption: All incoming arguments are good; there is no need to perform any checking. speed fps) :: constructor, initializes all instance variables, -init-(self, nun people should default to 0 when a bus is created with the constructor. max people, . nane, o o Assumptions: str(self) retus string representation with this fonmat (note, the quotes in the example are speed_fps and nax_people will always be a non-negative number name will be a non-empty string * just our string boundaries! The first character in this example string is N): Smithfield (e,3) Exchange tie:5.88 minutes” _str一(self) :: returns string representation with this format: Bus named GreyDog with S people will travel at 18.28mph o Notes: · The (03) in the example above are the coordinates of the town. Stop time is converted to number of minutes with 2 digits after the decimal point ” o Notes: ” The quotes in the example are just our string boundaries! The first character in the above example is B. This method reports nun _people (NOT max_people). ” . eq (self, other):: Override thecthod for Town objects; returns True or False. Cities should be “o each other if they are at the same kation (loc_x and loc_y), regardless of their name or stop time. For example, Town(“Smithfield”, 0, @, θ) and Town(“Snithy”, θ, θ, 10) would be the same since they are physically kocated in the same location. Bus speed is converted to mile per hour and always presented with 2 digits after the decimal point tine_to_travel (self, distance feet) travel distance_feet (distance in fect). Notes and Assumptions Returns how long (in whole seconds) this bus wl ake to distance_to_toun(self, town) Returns the distance between two towns (based on their x and y locations) as a loat (no truncating). Remember ab-c! o This always returns an integer – you could use integer division () or normal division followed by int) conversion to truncate the fractional part. You can assume that distance feet is always a non-negative integer. ourney class: Instance variables bus load_people(self, num_people) Attempts to put num_people onto the bus and update nun_people. If the number of people supplied would not fit on the bus, return False and do not change the number of pcople currently on the bus. [You may imagine this as “the pcople get into a fight and no one is allowed on the bus”.] :Bus # the bus r king the journey V the towns the bus will visit, in order # the time the bus will begin its journey # (in seconds since January 1st, 1970) list of Town objects int e destinations start tine Note and Assumptions: o You can assume that nun people is always a non-negative integer This function should return True if the people were loaded on the bus. Note: Why Thursday, Jan. Ist 1970? See: Show transcribed image text * . unload people(self, nun_people)::Attempts to remove nun people from the bus. If the number of people supplied is larger than the number of people on the bus currently, return False and do not change the number of people currently on the bus. [You may imagine this as “the people are so confused by the request that they just stay where they are looking confused”] Classes Many of the methods required below are very regular- after youve 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. You will be writing four classes (Bus, Town, and Journey). Make sure you understand what these represent and how they relate to each other before continuing. Note and Assumptions: ‘ You can assume that num people is always a non-negative integer. This function should return True if the people were unloaded from the bus. Town class: Bus class: Instance variables Instance variables: # te nan, of thg town : stnng int int int string # the name of the bus # the naxínum number of people the bus can transport i the number of people currently on the bus # how fast the bus travels (in feet per second) loc x the town’s x location (in an x-y-coordinate system) # the town’s y location (in an x-y-coordinate system) # how long (in number of seconds) buss stop in this town :int max_people e nun people 1oc int stop tine . speed fps Methods: Methods: init (self, name, loc x, loc y, stop tine) constructor, initializes all instance variables. Assumption: All incoming arguments are good; there is no need to perform any checking. speed fps) :: constructor, initializes all instance variables, -init-(self, nun people should default to 0 when a bus is created with the constructor. max people, . nane, o o Assumptions: str(self) retus string representation with this fonmat (note, the quotes in the example are speed_fps and nax_people will always be a non-negative number name will be a non-empty string * just our string boundaries! The first character in this example string is N): Smithfield (e,3) Exchange tie:5.88 minutes” _str一(self) :: returns string representation with this format: Bus named GreyDog with S people will travel at 18.28mph o Notes: · The (03) in the example above are the coordinates of the town. Stop time is converted to number of minutes with 2 digits after the decimal point ” o Notes: ” The quotes in the example are just our string boundaries! The first character in the above example is B. This method reports nun _people (NOT max_people). ” . eq (self, other):: Override thecthod for Town objects; returns True or False. Cities should be “o each other if they are at the same kation (loc_x and loc_y), regardless of their name or stop time. For example, Town(“Smithfield”, 0, @, θ) and Town(“Snithy”, θ, θ, 10) would be the same since they are physically kocated in the same location. Bus speed is converted to mile per hour and always presented with 2 digits after the decimal point tine_to_travel (self, distance feet) travel distance_feet (distance in fect). Notes and Assumptions Returns how long (in whole seconds) this bus wl ake to distance_to_toun(self, town) Returns the distance between two towns (based on their x and y locations) as a loat (no truncating). Remember ab-c! o This always returns an integer – you could use integer division () or normal division followed by int) conversion to truncate the fractional part. You can assume that distance feet is always a non-negative integer. ourney class: Instance variables bus load_people(self, num_people) Attempts to put num_people onto the bus and update nun_people. If the number of people supplied would not fit on the bus, return False and do not change the number of pcople currently on the bus. [You may imagine this as “the pcople get into a fight and no one is allowed on the bus”.] :Bus # the bus r king the journey V the towns the bus will visit, in order # the time the bus will begin its journey # (in seconds since January 1st, 1970) list of Town objects int e destinations start tine Note and Assumptions: o You can assume that nun people is always a non-negative integer This function should return True if the people were loaded on the bus. Note: Why Thursday, Jan. Ist 1970? See:

Expert Answer


Answer to * . unload people(self, nun_people)::Attempts to remove nun people from the bus. If the number of people supplied is lar… . . .

OR


Leave a Reply

Your email address will not be published. Required fields are marked *