Your simple past understanding is fine. In your example the present perfect and the present perfect continuous are practically interchangeable. In both cases, David is still working for them. With 'how long' questions it is often the case that the two are interchangeable.
Sometimes there is a slight difference between the meaning of the present perfect simple and present perfect continuous. They both have an effect that is valid in the present, but sometimes in the present perfect the action is complete while in the present perfect continuous it doesn't have to be.
A typical grammar book example is 'I have painted the ceiling' versus 'I have been painting the ceiling'.
In the first example, the effect is that I am happy now, in the present; the job is done.
In the second, the emphasis is on the process, the action. We do not know if the job is finished, just that the speaker was recently involved in painting the ceiling.
PS I should add that this is British English.
In general, the choice of grammatical aspect is, unlike tense, not strictly delineated. You can often choose between two or more aspects to express the same basic idea, because aspects have less to do with denotation, and more to do with connotation. In other words, aspects carry implications and tonality, but they have less effect on the literal meaning of the sentence. As a result, the "correct" aspect is often a matter of opinion and interpretation.
So, let's go through these examples:
John hasn't studied very well this term.
This is present perfect simple, as your book says. It carries the connotation that John's poor study habits are either already causing problems for him, or are likely to cause problems in the near future. For example, you might continue the sentence like this:
John hasn't studied very well this term, so now he's at risk of failing the exam.
The emphasis is on the consequences of the action, even if those consequences are not explicitly stated.
Now, let's look at your other example:
John hasn't been studying very well this term.
This is present perfect continuous. Since it's still a perfect aspect, it still conveys the same emphasis on consequences. However, it also suggests that there is still time for John to change his study habits. It sometimes shows up in cases where the action is interrupted or altered, as in this continuation:
John hasn't been studying very well this term, so the teacher gave him an extra assignment.
We could also have something like this:
John hasn't been studying very well this term, but he could still catch up.
These continuations are (for the most part) also possible with the simple perfect, but they make more logical sense in the context of the continuous perfect.
Having said all that, you generally cannot use the present perfect continuous in cases where the action is far in the past, or otherwise "complete." Similarly, the simple perfect is usually considered less appropriate for a continuous action which is still ongoing (although, as in our examples above, it can sometimes be used with habitual or repeated actions, especially when those actions are unlikely to continue).
Best Answer
I would have been able to comment had this still been in EL&U , where it should have remained because it's an interesting grammatical question, so you'll have to settle for a short answer.
Although "what have you been doing" may have a form whose name includes "perfect", the statement doesn't have a perfective aspect - because the questioner hasn't decided the person has finished doing whatever it was.
Wikipedia says
Had the questioner concluded the activity was over, they would have used the perfective "What have you done?" Also be aware a statement like this can imply something bad was done, so the questioner might back off from the perfective to avoid sounding rude.
Some languages (e.g Polish) have completely different verbs to express perfective or imperfective aspect; in English we settle for progressive/continuous tone.