Class Diagram- Not clear with reasoning

Please include the reasoning behind why certain method is part of a class and not in some other class and why link between two classes is of a certain type. and why only those variables, methods are sufficient. And why extends is needed at those places. I am not clear with the diagram.

Type your question above this line.


Hi Anupam!
Whenever we design any system, first of all, we enlist our requirements and all the functionalities which we need in our system. Then we proceed with the further steps. While describing all requirements we get an idea that which methods we’ll need to perform a specific task. Then we make a design/class diagram of the complete system and link the relationship between all classes. So we’ve followed the same strategy to implement this parking lot system.

We’ve described all methods related to a certain class that will perform that task and to simplifies our code. For example, if we talk about the vehicle class in the lesson, we’ve mentioned the type variable there to specify the type of vehicle so that we can get that whether it is a car or a truck, etc. We’ve added the assignTicket method in the vehicle class to check that either ticket is assigned to that vehicle or not. So adding the type variable and assignTicket method in the vehicle class is making sense that a vehicle has a type and contains a ticket. Adding the type variable in the Admin class does not make any sense.
We have used extend there to use the functionalities of a class in the other one. The whole diagram shows the same relationship between all the classes.

I hope it helps. If you still face any confusion please let us know.
Thank you.