[Authentic] Assignment – information about getting assistance,

Details: 1CS 112 – Project 6 ClassesDue Date: SUNDAY, May 5th, 11:59pmE.C. Deadline: Thursday, May 2nd, 11:59pmSee the “project basics” file for more detailed information about getting assistance, running the test file,grading, commenting, and many other extremely important things.Background: Classes allow us to define new types for Python. We can first think of a class as defining a newcontainer – instead of a list, tuple, set, or dictionary, we can have our own collection of values, each witha chosen name. We can then read out a value or update a value, much like reading or replacing the values in alist or dictionary. But we can also put methods in a class definition, giving us a way to specify the exact wayswe should interact with values of this new type.Once we have created a class definition, we can create as many objects of the new type as we want and usethem in our programs. We can create entirely new types during the design phase of writing a program. Thisenables us to think in terms of types (and instances of types) that better model what we see in the real world,instead of endlessly relying on lists or dictionaries (and having to remember exactly how we intended to usethose things as proxies for the values we actually had in mind).Problem Statement: You will create world with towns, busses, and exciting journeys! This will require someproscribed class definitions. Some of the classes build upon each other – this is an example of aggregation.Reminder: Your grade is based significantly on passing test cases. Don’t let yourself be “almost done” with afunction, but be missing all the test cases!RestrictionsWe’ve finally learned a substantial bit of programming! On this assignment, don’t import anything except math;other than that you should be able to use any built-ins that you want; the project focuses on class structure, sothere’s not likely to be things that would make for any shortcuts.Additional Requirement: Unless specified, your functions should not have any “side effects” (i.e. they maynot impact variables passed into the function/method).ProcedureComplete the class definitions as described; you can test your code with the included testing file: Invoke it as with prior assignments: python tester6p.py yourcode.py You can also test individual parts of the code, but note that you either want to type a class name or thename of a batch of test cases. You can either use the class name to test __init__, __str__, and __eq__(any ‘basic functionality’ tests), or the other method names from Bus, Town, and Journey classes:python3 tester6p.py yourcode.py Buspython3 tester6p.py yourcode.py unload_peoplepython3 tester6p.py yourcode.py Bus Town Journey add_destination … You can also run your code in interactive mode: python –i yourcode.py2ClassesMany 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. You will be writing four classes(Bus, Town, and Journey). Make sure you understand what these represent and how they relate to each otherbefore continuing.Bus class:Instance variables:

namemax_peoplenum_peoplespeed_fps
:: string:: int:: int:: int
# the name of the bus# the maximum number of people the bus can transport# the number of people currently on the bus# how fast the bus travels (in feet per second)
Methods:

__init__(self, name, max_people, speed_fps) :: constructor, initializes all instance variables,num_people should default to 0 when a bus is created with the constructor.o Assumptions:

speed_fps and max_people will always be a non-negative numbername will be a non-empty string

__str__(self) :: returns string representation with this format:“Bus named GreyDog with 5 people will travel at 10.20mph”
o Notes:

The quotes in the example are just our string boundaries! The first character in theabove example is B.This method reports num_people (NOT max_people).Bus speed is converted to mile per hour and always presented with 2 digits after thedecimal point.


time_to_travel(self, distance_feet) :: Returns how long (in whole seconds) this bus will take totravel distance_feet (distance in feet).o Notes and Assumptions:

This always returns an integer – you could use integer division (//) or normaldivision followed by int() conversion to truncate the fractional part.You can assume that distance_feet is always a non-negative integer.

 load_people(self, num_people) :: Attempts to put num_people onto the bus and update num_people.If the number of people supplied would not fit on the bus, return False and do not change thenumber of people currently on the bus. [You may imagine this as “the people get into a fight and noone is allowed on the bus”.]…

Posted in Uncategorized