Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Martin and Diane are working on a class diagram for the bike share system. Their

ID: 3868475 • Letter: M

Question

Martin and Diane are working on a class diagram for the bike share system. Their class diagram has a bike class. Now they want to represent the requirement that bikes can either be rented or available. Martin suggests that this needs to be shown in a state diagram (with rented and available as states of a bike). But Diane suggests that they need to create these two as sub-classes of the bike class (i.e. as an inheritance hierarchy - rented bike and available bike as two child classes of the super class bike, rather than as states. Who do you agree with? Justify your answer. Answer:

Explanation / Answer

making two sub classes of the bike class seems to be good idea as there are many common properties that can be required for both the renting and available bike. For example, like power, mileage, pickup are some properties which are required for both type of the bike and getters and setters functions can be used to access and modify these properties in the super class itself(i.e. bike superclass). There may be some specific properties/functions depending on the type renting/available of the bike which can be described in their respective subclasses while inheriting most of the properties from the superclass.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote