Name: ____________________________________________________ Alpha: _____________________

Describe help received: _________________________________________________________________

  1. [15Pts] Consider the expressions on the right (below) as if they appeared at the <---________. Mark each as: "OK", "access error", or "syntax error". Note that if there's a syntax error, there cannot be an access error. I.e. until the syntax is correct, you cannot even talk about whether access is allowed.
    Foo.javaBar.javaOK / access error / syntax error
    public class Foo
    {
      private String s;
      private static int c = 0;
      public String show() 
      { 
        return "[" + s + "]"; 
      }
      private char first()
      {
        return s.charAt(0);
      }
      public static int mys()
      {
        return c++;
      }
      public static void prob()
      {
        Foo f = new Foo();
        Bar b = new Bar(3,7);
        //<<---_________
      }
    }
    public class Bar
    {
      private int x;
      public int y;
      public static int z = 0;
      public Bar(int a, int b)
      {
        x = a;
        y = b;
        z++;
      }
      public int sum()
      { 
        return x + y; 
      }
      private int div()
      {
        return x/y;
      }
      public static int check()
      {
        return z;
      } 
    }
    a.  b.y         ___________________
    
    b.  Bar.z       ___________________
    
    c.  b.div()     ___________________
    
    d.  first()     ___________________
    
    e.  sum()       ___________________
    
    f.  f.show()    ___________________
    
    g.  f.first()   ___________________
    
    h.  c           ___________________
    
    i.  Bar.check() ___________________
    
    j.  s           ___________________
    
    k.  z           ___________________
    
    l.  b.x         ___________________
    
    m.  check()     ___________________
    
    n.  show()      ___________________
    
    o.  Bar.y       ___________________
    
  2. [70Pts] Download the file Countdown.java. You are not allowed to modify this file. Using it, write a program to print out the lyrics to 99 bottle of beer on the wall (like this: http://www.99-bottles-of-beer.net/lyrics.html) to the terminal. You must make reasonable use of the Countdown class. You may not model your solution on existing programs to do this: the point is to make use of the Countdown class!
  3. [15Pts] Which methods/fields from the Countdown class comprise the interface?
    Which methods/fields from the Countdown class comprise the implementation?
    Which methods/fields from the Countdown class serve neither role? What is/are it/they for?