Write a Program That Implements the Following Processing Requirements

CSC 202J

Lab 2

Due October 11, 2015


Write a program that implements the following processing requirements:

1.  Similar to Lab 1, using command line (System.in and the Scanner class) or the JOptionPane class dialogs, your code should allow the user to input and store unique (without duplicates) social security numbers (SSNs).

2.  You will need to code two new classes SSNArrayExpanded and SSNArrayTestExpanded and to reuse the class SSNArray from Lab 1.

3.  The class SSNArrayExpanded should:

a.  Extend (as a subclass) the SSNArray class.

b.  Have at least 2 constructors - the default (no-argument) constructor and another constructor that allows the user to set the SSN array size.

c.  Override the validateSSN() method defined in the SSNArray class to make sure that not only the SSN entered by the user is in a valid format but also that this new SSN is not a duplicate of an already existing SSN array element.

4.  The test class SSNArrayTestExpanded should work similar to the SSNArrayTest class but use the SSNArrayExpanded class instance to validate input format and to store SSNs without duplicates.

5.  When the data input is done, the test class SSNArrayTestExpanded should display all data elements in a user readable format.

6.  Your code should allow the user to enter as many SSNs as necessary as well as to stop data entry and exit at any time.


1.  Use the incremental development approach.

2.  Reuse as much code from Lab 1 as possible and make sure that none of the superclass SSNArray members are duplicated in the subclass SSNArrayExpanded.

3.  Assume that the valid SSN format is ddd-dd-dddd where each d represents a single digit.

4.  You may assume that the maximum number of SSNs to be stored in the array (array size) is known in advance so there will be no need to resize the SSN array.

5.  Make sure that you follow Object Oriented Design guidelines – all class data fields are private, proper constructors, accessor and modifier methods are provided, subclass design is as simple as possible.

6.  Justify the design of the subclass SSNArrayExpanded in your report.

7.  The sample code files can be retrieved using the following steps:

a. Go to http://cs.salemstate.edu/brikman/.

b. Click on the link labeled “CSC 202J” and then on the link “Source code (7-Zip)”. Download the file source.7z to your computer.

c. Using WinZip, 7-Zip or any other utility unzip the source.7z file.

8.  Follow the instructions carefully.

9.  Save your work regularly, especially at the end of each class.

10. Keep a detailed record of all steps performed.

11. Submit your lab report that includes items 1– 9 described in the Laboratory/Program Report Specifications document.


1.  When creating project using a computer in the Computer Science Department laboratories (MH 202/209/210), always make sure that the project and all associated files are on the disk drive that you will be able to access next time. This drive may be h: drive on the Computer Science Department LAN, USB flash drive, etc. Never store any files on the local drives c: or d: as these files will be automatically deleted after you log off.

2.  When submitting lab or programming assignments, always follow the home work submission guidelines described in the Laboratory/Program Report Specifications document CS202Report.doc that can be downloaded from my Web site cs.salemstate.edu\brikman.