CS 120,  WINTER 2016,  Instructor:  Jeffrey Horn    QUIZ 5:  METHOD CALLS  NAME:   _____________________ 

 OPEN NOTES, but NOT OPEN COMPUTER and NO COLLABORATION!!!!

Review the code for the "clamp(int x)" method below and answer the questions based on it.

//  clamp(x,min,max) returns x if x is between min and max inclusive.  Else it returns the nearest (to x) of min and max.
private int clamp(int x, int min, int max)
       {
     if (x < min)   { return min; }
     if (x > max)   { return max; }
     return x;

   
}
  1. Fill in the correct values for the following parts of a method signature using the values from the signature for the "clamp()" method above (i.e., "private, static, int, clamp, int, health"):
  2. What does "clamp(-50,0,100)" return?         _____________________

  3. What does "clamp(1050,0,100)" return?         _____________________
  4. What does "clamp(91,0,100)" return?         _____________________