please solve 1 and 2. i have provided the java code as well.
Numbered items all have approximately equal weight. There are extra points built into the scoring system. Show all work! Answers without adequate support will receive significantly reduced credit. Partial credit is available on most items. 1. Refer to the Java code for MyClass 1, My Class2, and MyDriver in the Supplement. When I ran this program, the output was as follows: ----GRASP exec: java MyDriver Value of a - 57 Value of a = 42 L ----GRASP: operation complete. a. Explain this output. b. What is meant by aliasing? How does this code illustrate this phenomenon? c. Briefly discuss the impact of aliasing on readability, writability, and reliability? 2. Consider the following context free grammar for expressions with the "weird" operations ? and $:
? | $ () | abc a. Use the expression "a? b $c" to show that this grammar is ambiguous. b. Now write an unambiguous grammar for expressions in which (1) parenthesized expressions take precedence over any other expression, (2) the operation S takes precedence over ?, and (3) $ is left associative and ? is right associative. (HINT: You may need to use some additional non-terminals.) Item 1 uses the following Java code: class Myclassi { private int a; public void setA (int value) (a = value; } public int getA {return a; } class MyClass2 { private MyClassi myobjecti - new MyClass(); public void setMyObjectIA (int value) { myObjecti.setA (value); public MyClassi getMyObjectif return myObjectl; public void myMethod (Myclass1 anobject) { anObject.setA (42); class MyDriver { public static void main (String[] args) { MyClass2 myObject2 = new MyClass2(); myObject2.setMyObject1A (57); System.out.println ("Value of a = " + myObject2.getMyObject1().getA()); MyClassl myObject = myObject2.getMyObject1(); myObject2.myMethod (myObject); System.out.println("Value of a = " + myObject2.getMyObject1().getA())