Homework_4

Homework_4 - Homework 4 Due Date: January 26, 2010 This...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
Homework 4 Due Date: January 26, 2010 This homework assignment is for you to practice implementing Immutable pattern. You will implement an immutable class – ImmutableIntegerArray – as defined in the following UML class diagram. You can implement the Integer type specified below as Java primitive type int or Integer class. You need to male sure that your getArray () does not return reference to the array stored in the ImmutableIntegerArray object. You can use clone () to achieve this. The changeArray() will return a new object of ImmutableIntegerArray which contains the exact same data except for the element in index will have the newValue . You also needs to implement a toString () which will print out the values of the array. Your main (client) program will do the following: 1. Create an instance of ImmutableIntegerArray by calling one of the constructors passing in the values of the array. 2.
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 01/17/2012 for the course GCIS 518 taught by Professor Tang during the Spring '10 term at Gannon.

Ask a homework question - tutors are online