CP2003 - Tutorial Six: Stuff
- Assignment Submittal. Your assignment is due at the start of this
tutorial. Your tutor will come around and test your work.
- Java passes function arguments by value. Simulate C++'s pass by reference
in Java. More precisely, simulate the following
void MyFunction(int &x) { x++; }
Hint: Use an Integer object that wraps around a Java int. Use the
object reference of that Integer as the argument to your Java function.
Test your Java function
- Consider the "notorious"
Zoo.java
(or Pets.java) example.
Suppose the random number
generator generated the numbers 0, 1, 4, 4, 2, 3, 0, 1. What would
the output of the program be for that case?
- Consider the interface FIFOQueue and the implementation CircularArray
from the lecture notes. Give a third implementation LargeCircularArray
which is exactly as CircularArray except that it can hold up to
1000 elements. Alter the test-driver program appropriately, re-compile
and re-run the test-driver program.
- Further to last week's experimentation with
ExGui2.java, after change the title of
the frame, try adding an additional checkbox called "Black Olives"
appearing between "Green Olives" and "Small Cheese Platter". This
checkbox also needs to be reported in the text-field if checked.
- Finally, compile and "play" with
ExGui3.java.
Copyright © 2000. James Cook University. All rights reserved.