Name: ____________________________________________________ Alpha: _____________________

Describe help received: _________________________________________________________________

  1. [52Pts] Consider class Bar derived from class Bar as shown below:
    Foo.java Bar.java HWa.java
    public class Foo
    {
      public void func1(int x)
      {
        System.out.println("in F1");
      }
      public void func2(char c)
      {
        System.out.println("in F2");
      }
      public void func3()
      {
        System.out.println("in F3");
      }
      public static void func4()
      {
        System.out.println("in F4");
      }
    }
    public class Bar extends Foo
    {
      public void func1(int x)
      {
        System.out.println("in B1");
      }
      public void func2(double d)
      {
        System.out.println("in B2");
      }
      public void func5()
      {
        System.out.println("in B5");
      }
      public static void func4()
      {
        System.out.println("in B4");
      }
    }
    public class HWa
    {
      public static void 
        main(String[] args)
      {
        Foo f = new Foo();
        Bar b = new Bar();
    
        /* HERE! */
      }
    }
    Consider each expression below as appearing at the HERE! in file HWa.java, and write either "error" if the expression won't compile, or write the output that the resulting function call would produce.
    1. f.func1(38)  ______
    2. b.func1(38)  ______
    3. f.func2('A') ______
    4. b.func2('A') ______
    1. f.func2(1.8) ______
    2. b.func2(1.8) ______
    3. f.func3()    ______
    1. b.func3()    ______
    2. func4()      ______
    3. Foo.func4()  ______
    1. Bar.func4()  ______
    2. f.func5()    ______
    3. b.func5()    ______
  2. [48Pts] Complete AcMid so that the following code produces oputput: 172234 Poe SCS
    AcMid m = new AcMid("Poe","172234","SCS"); System.out.println(m.toString());
    Mid.java AcMid.java
    public class Mid
    {
      private String last;
      private String alpha;
      public Mid(String ln, String al)
      {
        last = ln;
        alpha = al;
      }
      public String toString()
      {
        return alpha + " " + last;
      }
      public String getAlpha()
      {
        return alpha;
      }
      public String getLast()
      {
        return last;
      }
    }
    public class AcMid extends Mid
    {
      private String major;
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    }