Question: 3. (10 points) Consider the following code. = new SimpleWriter1L() ; SimpleWriter out NaturalNumber example = new NaturalNumber2 (11); NaturalNumber count new NaturalNumber2 (1);

3. (10 points) Consider the following code. = new SimpleWriter1L() ; SimpleWriter

3. (10 points) Consider the following code. = new SimpleWriter1L() ; SimpleWriter out NaturalNumber example = new NaturalNumber2 (11); NaturalNumber count new NaturalNumber2 (1); NaturalNumber[] array = new NaturalNumber[5]; Array[4] new NaturalNumber2(0); for (int i = 0; i < array.length 1; i++) { array[i] new NaturalNumber (count); } = array[4].add(array[i]) ; count.increment (); for (int i 0; i < array.length; i++) { } out.print(array[i] + "+) ; out.print("=" + array[4]); 3.1 (8 points) Draw a picture tracing the value of each array and NaturalNumber references and their corresponding objects. One has been done for you as an example. You do not need to trace the SimpleWriter variable. Make sure you show each step of the above program in your diagram. If reference or object values change, indicate this by crossing off the old value with an X. Do not draw any extra circles when a variable's object values changes but its reference does not. example 11 3.2 (2 points) Show exactly what the program will print.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

Answer SimpleWriter out NaturalNumber example NaturalNumber c... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!