[SOLVED] CS计算机代考程序代写 “””

30 $

File Name: CS计算机代考程序代写_“””.zip
File Size: 367.38 KB

SKU: 1340346894 Category: Tags: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,

Or Upload Your Assignment Here:


“””
QUESTION 2: Object Oriented Programming

8 marks, ~15 minutes

(a) Write a series of classes that satisfy the following specification.

A parking garage has an address (an arbitrary string), and zero or more vehicle
parked in it. Because of local laws a parking garage can host at most 1000
parking spots. If a vehicle tries to enter the parking garage that does not have
enough parking spots left, a NoParkingAvailableError is raised.

A vehicle can either be a truck or a car. Trucks are longer than cars and have
to park at an angle, taking up two parking spots at a time. Cars can park
normally and take up one parking spot in the parking garage.

Both trucks and cars have a make, colour and year in which they are built.

TODO: Write your code below here.

You may import any type of from “typing” for type contracts. No other import is
allowed.

Documentation are not required for the marking of this question; however, it may
help the TAs understand your code better.
“””

“””
(b) Write code in the __main__ block below to perform the following.

– Create a new parking garage.
– Write a loop and add 400 trucks and 199 cars to the parking garage.
– Ask the user for a year, make and colour of a car and instantiate a new
object with these attributes.
– Add the newly created car to the parking garage with the following
considerations:
– If this raises a NoParkingAvailableError, print “Sorry, No parking” without
crashing the program.
“””

if __name__ == “__main__”:

# TODO: write your main-block code below here
pass

Reviews

There are no reviews yet.

Only logged in customers who have purchased this product may leave a review.

Shopping Cart
[SOLVED] CS计算机代考程序代写 “””
30 $