Task 5 - Adding More Methods Using More OOP
Task 5 - Adding More Methods Using More OOP
OOP
Now that you have working classes, we will refine them slightly. Read the instructions
carefully and then edit the classes from the previous tasks.
methods in the property classes. You may or may not need to implement in one or all of the
three property classes, you need to figure out where it would suit best.
You need to copy and paste the code for these classes from Task 4 into the appropriate files
given in this slide's scaffold and then add these methods.
You should try and use the methods that have been defined in the classes rather than calling the variables
themselves. Doing so will result in a loss of marks.
Completing this part should pass the tests from 5.1 to 5.4.
amenity and the subtype (if applicable), and return a Tuple containing an object of the
Amenity class that is the closest amenity of this type and subtype as well as the distance to
this particular Amenity.
If the value of the type or subtype doesn't exist or is invalid, then this method will return None.
Please note that if the subtype is Pri/Sec is a school, then that school should appear in both Primary and
Secondary searches.
If a amenity_subtype is not provided, then it should consider all amenities of that type and return the closest
one.
You may want to copy the haversine function to this class but ensure to make it a private function of this
class rather than a global function in the file as this will fail test cases.
Completing this part should pass the tests 5.5 and 5.6
Once you add the three new methods, and if all works well then you should see an output
similar to the following:
The nearest station to 3 Antrim Place Langwarrin VIC 3910 is Baxter Railway Station
(Baxter) and it is 3.67km away
The property at G01/7 Rugby Road Hughesdale VIC 3166 has the following features:
['dishwasher', 'air conditioning', 'balcony']
We are going to add 'tennis court' as a feature to this property
Now the property at G01/7 Rugby Road Hughesdale VIC 3166 has the following features:
['dishwasher', 'air conditioning', 'balcony', 'tennis court']