CallList - //calls = new...

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

View Full Document Right Arrow Icon
import java.util.*; // for ArrayList i public class CallList p { // A CallList tracks several PhoneCall // objects // Option 1: array PhoneCall [] calls; int numCalls; // used to track used/empty // spaces in the array // Option 2: ArrayList //ArrayList<PhoneCall> calls; CallList () // constructor { // Option 1 calls = new PhoneCall[20]; numCalls = 0; // Option 2
Background image of page 1

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

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

Unformatted text preview: //calls = new ArrayList&lt;PhoneCall&gt; (); } void add (PhoneCall p) { // Option 1 calls[numCalls] = p; numCalls++; // update counter } public String toString() { String result = &quot;Calls to make:\n\n&quot;; // Option 1 for (int i = 0; i &lt; numCalls; i++) { result += calls[i].toString(); result = result + &quot;\n&quot;; } return result; } }...
View Full Document

This note was uploaded on 11/24/2010 for the course CSE 114 taught by Professor Tashbook during the Spring '08 term at SUNY Stony Brook.

Page1 / 2

CallList - //calls = new...

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