Name: ____________________________________________________ Alpha: _____________________
Describe help received: _________________________________________________________________
<---________.
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.java | Bar.java | OK / 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 ___________________ |
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!
submit -c=IC211 -p=hw05 HW5.java
and printout using the codeprint button from the submit
system.