Stubs and main program
<p>I have to design and implement a program to accomplish drum stick matching (not the eating one). There are two parameters I have to check i.e Weight and Pitch (acoustical property) for the two different drumstick and find pair of matching drumstick. I created three classes i.e Bin, Sorter and Stick and in project description Robot class is given and this is stub class. </p>

<pre><code>Robot
+WEIGHT_TOLERANCE: int
+PITCH_TOLERANCE: int
+get_new_bin(void): bool
+is_bin_empty(void):bool
+load_sticks(number:int):int
+test_stick(location: int, pitch: int, weight: int): bool
+pair_sticks(first_location: int, second_location: int): bool
+return_sticks(void): bool
</code></pre>

<p>I want to shift all my logic to the main class, since my professor told me that this Robot class is fake class (stubs), so I created some of the method int load_sticks(int number) but I am having error in declaring </p>

<pre><code>my_sorter = new Sorter();
my_bin = new Bin();
</code></pre>

<p>in the main class. I do not know how can I instantiate these object in main class.
Could any one tell me what should I do with this? </p>

<p>This is my code for Robot class source file. I can post my other classes also but I just want to work on this problem. I hope one can understand with this class only.</p>

<pre><code>#include "Robot.h"

#include&lt;iostream&gt;
#include &lt;string&gt;
#include "Sorter.h"
#include "Bin.h"
#include "Stick.h"

using namespace std;

// Default constructor
Robot::Robot(void)
{
    WEIGHT_TOLERANCE = 3;
    PITCH_TOLERANCE = 20;
    my_sorter = new Sorter();
    my_bin = new Bin();
}
</code></pre>

<p>I removed all other methods so that it will be readable to all </p>

<pre><code>// Load sticks into the sorter from the bin

int Robot::load_sticks(int number){
    // Declare and initialize the int sticks_loaded to be returned
    int sticks_loaded = 0;
    // Verify the number of sticks requested to be loaded doesn't exceed the number in the bin
    //if(number &lt; my_bin-&gt;get_size()){
    /* If the number of sticks requested plus the current size of the sorter is less than the sorter's maximum
     * capacity, add the number of sticks requested
     */
    if((my_sorter-&gt;get_size() + number) &lt;= 200)
    {
        sticks_loaded = number;

        // Load the number of sticks requested
        for(int i = 0; i &lt; number; i++)
        {
            // Call the load() method in the sorter class to add each stick to the sorter
            my_sorter-&gt;load(my_bin-&gt;get(i));
        }

        // Remove the sticks that have been added to the sorter from the bin
        my_bin-&gt;remove(0, number);

        // After the sticks have been loaded, sort the sticks in the sorter
        my_sorter-&gt;sort_sticks();

        // Print out the contents of the sorter after loading
        cout &lt;&lt; *my_sorter &lt;&lt; endl;
    }

    /* If the number requested plus the current size of the sorter exceeds the sorter's capacity,
     * add sticks to the sorter until it has reached it's capacity
     */
    if((my_sorter-&gt;get_size() + number) &gt; 200)
    { 
        cout &lt;&lt; "Requested too many!" &lt;&lt; endl;
        // sticks_loaded = the maximum capacity of the sorter minus it's current size
        sticks_loaded = 200-(my_sorter-&gt;get_size());

        cout &lt;&lt; "Sticks can load: " &lt;&lt; sticks_loaded &lt;&lt; endl;
        for(int i = 0; i &lt; sticks_loaded; i++)
        {
            // Load the sticks from the bin into the sorter
            my_sorter-&gt;load(my_bin-&gt;get(i));
        }

        // Remove the sticks which were added to the sorter from the bin
        my_bin-&gt;remove(0, sticks_loaded);

        // Sort the sticks after loading
        my_sorter-&gt;sort_sticks();

        // Output the contents of the sorter after loading
        cout &lt;&lt; *my_sorter &lt;&lt; endl;

    }

    return sticks_loaded;
}
</code></pre>
