ComboLock - } //equals method public boolean...

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

View Full Document Right Arrow Icon
package lab9; p public class ComboLock { int lockerId; String combination; S //default and overloaded constructors public ComboLock() { lockerId = 000000; combination = "--------"; } public ComboLock (int iD, String combo) { lockerId = iD; combination = combo; } //accessor methods public int getId() { return lockerId; } public String getCombination() { return combination; } //mutator methods / public void setId(int anId) { lockerId=anId;} l public void setCombination(String aCombo) { combination=aCombo;
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: } //equals method public boolean equals(ComboLock theLocker) { return(lockerId==(theLocker.getId())&& (combination==theLocker.getCombination())); } public int compareTo(Object anObj) { if(this.toString().compareToIgnoreCase(anObj.toString())<0) return -1; else if(this.toString().compareToIgnoreCase(anObj.toString())>0) return 1; else return 0; } public String toString() { return "Locker ID: "+lockerId+"\tCombination: "+combination; } }...
View Full Document

Page1 / 2

ComboLock - } //equals method public boolean...

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