I am trying to find the best design approach to solve an interview question. I appreciate if you could send me UML diagram and the code (Java/C++). Also, please guide me how to start (thinking about) modeling objects.
I would like you to design a transportation network. A transportation network has warehouses, and trucks that transfer items from one warehouse to another.
How would you represent this system in Java (or C++)?
Could you draw a diagram, say a UML diagram, of the classes in question?
I want to add a cost to the routes from one warehouse to another. How would you change the system? (Add a couple more attributes if necessary until a Route class appears.)
Trucks have a particular amount of fuel in them. I want to make sure that one truck can reach another warehouse in the system without running out of fuel. How would you change the system to do that? (They must add methods and classes to their system to effect the change.)
What if only certain items can be delivered to a particular warehouse? Example: Warehouse A can have only books, Warehouse B can have only CDs, Warehouse C can have both books and CDs. Given a particular item, we want to know the lowest cost path to a warehouse that can take this item. How would you change the system to do this? (Candidates must add attributes/methods to warehouses.)