Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>If what you're saying is that you have an array of <code>Employee</code>, and each <code>Salesman</code> (only) has a member that provides the orders himself has sold, then you have to work with an array of array.</p> <p>At first view, your <code>Employee</code> array is more likely a vector, that is, a one dimensional array. Plus, your <code>Salesman</code> class has an <code>Order</code> array which also seems to be a vector. If this is what you actually got, you only have to iterate through your <code>Salesman.Orders</code> member to get the sales your <code>Salesman</code> did.</p> <p>Since it is tagged as <code>[homework]</code>, I refuse to write the code and give you it all cooked for you.</p> <p>Besides, here are some hints:</p> <ol> <li><p>You already iterate through an array of <code>Employee</code>, so you know how to iterate through one;<br></p></li> <li><p>You say that a <code>Salesman</code> derives from the <code>Employee</code> class, hence making <code>Employee</code> perhaps type-castable to <code>Salesman</code>, and then you shall get your instance of the <code>Salesman</code> class, it this actual <code>Employee</code> IS a <code>Salesman</code>, otherwise it should return null;<br></p></li> <li><p>Now, you access your fields through property methods (getters and setters methods);</p></li> </ol> <blockquote> <p>So, how could you make <code>Orders</code> accessible from the outside of your class, and expose it as an array?</p> <p>If you've been able to expose it as an array, how do you iterate through an array to get each of the orders amount so that you may calculate how much this instance of <code>Salesman</code> has sold?</p> </blockquote>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload