Quiz 3

Please write your name and lab section letter at the top of the page.

  Emote e1 = new Emote(10, 20);
  Emote e2 = new Emote(30, 40);

  e1.setHappiness(10);
  e2.setHappiness(50);

  Transcript.println("Emote e1 is this happy: " + e1.getHappiness()); /* 1 */
  Transcript.println("Emote e2 is this happy: " + e2.getHappiness()); /* 2 */

  Emote e3 = e2;

  Transcript.println("Emote e3 is this happy: " + e3.getHappienss()); /* 3 */

  e3.adjustHappiness(e2.getHappiness());

  Transcript.println("Emote e1 is this happy: " + e1.getHappiness()); /* 4 */
  Transcript.println("Emote e2 is this happy: " + e2.getHappiness()); /* 5 */
  Transcript.println("Emote e3 is this happy: " + e3.getHappienss()); /* 6 */
  1. What value for getHappiness() do the println calls show?
       1) 10     2) ?   3) ?    4) ?   5) ?   6) ?
    
  2. How many objects are instantiated (created) above?
  3. How many reference variables are declared?