interpretation of attached UML diagram in Java Pse

2019-09-07 20:11发布

问题:

I would like to translate the attached UML to Pseudocode. I have the following class and interface headers below. I would like to know

1) if this is correct?

2) what is the relation between Store and Manager and Store and StoreEmployee? I have Manager and StoreEmployee as private fields in Store. Is this correct? if yes, then why they are not included in attributes

3)What is the relation between store and Store Test ?

4) I have Employee as interface while PayRoll Record as concrete class? Is this correct? both have broken line arrow connection?

public interface Employee { }

public class Manager implements Employee{ }


public class StoreEmployee implements Employee{ }

public class SalesAssociate  extends StoreEmployee { }

public class PayrollRecord { } // 

public class Store  extends PayrollRecord { } // does it have Manager and StoreEmployee as private fields

public class StoreTest { } //does it have Store as private field

回答1:

Here are some quick answers that don't fulfil your questions perfectly, while still hopefully point you in the right direction.

  1. You have your extends mixed in with your composed of. Check your UML documentation again. So, no you are incorrect.. but also correct in some places. :)
  2. A Store has a single manager (if there is not a number attached, then it is assumed to be a 1..1 relationship).
  3. Look at how you used the same arrow in previous solutions.
  4. Yes, look at the heads of the arrows. The Employee implies inherits from, where the PayRollRecord is just a general usage arrow.

For these, the previous answers should help you answer your questions here. :)

public class Store  extends PayrollRecord { } // does it have Manager and StoreEmployee as private fields

public class StoreTest { } //does it have Store as private field