CellPhoneBookEntry

CellPhoneBookEntry - { comparisons++; return

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

View Full Document Right Arrow Icon
public class CellPhoneBookEntry { private String name; private String cellnum; public CellPhoneBookEntry(String name, String cellnum) { this.name = name; this.cellnum = cellnum; } public void print() { System.out.println(name + "\t" + cellnum); } public String getCellNumber() { return cellnum; } public void setCellNumber(String cellnum) { this.cellnum = cellnum; } public int compareTo(CellPhoneBookEntry other)
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: { comparisons++; return this.name.compareToIgnoreCase(other.name); } public int compareTo(String othername) { comparisons++; return this.name.compareToIgnoreCase(othername); } // comparison-counting private static int comparisons = 0; public static int getComparisons() { return comparisons; } public static void resetComparisons() { comparisons = 0; } }...
View Full Document

Ask a homework question - tutors are online