Help with some programming!!

As Paul asked, you need to tell us what is not working.

The servo() function appears to be called once for each day that feeding is needed (numberofdays) and is called twice each day, but only if setCounter is 7

    else if (setCounter == 7)
    {
      if (feedinterval == 2)
      {
        for (int j = 0; j <= numberofdays; j++)
        {
          servo();
          delay (12000);
        }
      }
    }

This is in the loop() function so, if nothing happens to stop it the next time through loop() it will happen all over again. This is the reason that I suggested you keep a count of how many times the servo had moved and stop it happening once the required number of moves has taken place.