lab3 - 15-121 FALL 2009 [CORTINA/REID-MILLER]LAB 3In this...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: 15-121 FALL 2009 [CORTINA/REID-MILLER]LAB 3In this lab, you will build a class to implement a special array list that stores its values in increasing order. First, you will do this using the Java ArrayListclass. Then you will do this using a class that implements an array list directly using an array. EXERCISESDownload the OrderedArrayList.zipproject file. This project contains a CalendarDateclass that models a calendar date with a month, day and year (e.g. 7/4/1776). A CalendarDateimplements the Comparableinterface which requires it to have a compareTomethod. Using the compareTomethod:If we have two objects aand bthat are Comparable, then the method call a.compareTo(b)returns a positive integer if ais "greater" than b, a negative integer if ais "less" than b, or 0 if they are the same. For dates, the comparison is based on chronological ordering. Example: If ais the date 12/4/1967 and bis the date 6/29/1951, the expression a.compareTo(b)returns a positve integer since acomes after bchronologically. chronologically....
View Full Document

Page1 / 2

lab3 - 15-121 FALL 2009 [CORTINA/REID-MILLER]LAB 3In this...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online