Lab 2 Solution


Category: Tag:


Provided is that is an unchangeable Java file.

Your task is to complete the program based on the API specifications. Program flow is:

  • You will prompt the user for the name of the input file.

  • You will open that file and count the number of lines in the file

  • You will create and fill an array of type person for each record that is in the file.

  • The array is then sorted by calling the compareTo of Person

  • A menu is displayed


  • You must range check all values

  • You may assume all letters will be lower case for any input obtained by your program

  • You must ensure the parameterized type of Person is passed to compare/compareTo

  • You need to capitalize the name when you print out the name

  • All parameters will be final and all preconditions will be checked

  • You will need your FileUtil and SortUtil methods from Lab1. Just copy over the folder cscd211Utils.

  • You must create an input file that allows you to sufficiently test the specifications of this assignment.

  • I have provided the Javadocs from the solution. Please see index-all.html inside the docs folder.


A zip file, in Canvas, by the required due date containing:

  • all java files

  • the input file(s) used to test your program program

  • a test run named cscd211lab2out.txt – testing all aspects

  • We should be able to download the zip and compile your code, and then run your code.

  • Name your zip

your last name first letter of your first name (Example:

error: Content is protected !!