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 HW5.java that prints out the lyrics to 99 bottle of beer on the wall. Proper output should look like this: output.txt. You may not model your solution on existing programs to do this: the point is to make use of the Countdown class!
    Note: concentrate on the basic lyrics, and only afterwards worry about capitalization, "one bottle" versus "one bottles" and "no more" versus "zero". Feel free to lookup how to get the first letter of a string capitalized if you are having difficulty with it.
    Turn In Submit as submit -c=IC211 -p=hw05 HW5.java and printout using the codeprint button from the submit system.
  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?