Town - public String toString return super.toString" and has population" pop public boolean equals(Object obj return(obj instanceof

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

View Full Document Right Arrow Icon
//Town public class Town extends Region{ private int pop;//variable for population of the town public Town(String s, int a, int p){ super(s,a); pop=p; } public int getPopulation(){ return pop; } public void setPopulation(int p){ pop=p;
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: } public String toString(){ return super.toString()+" and has population "+pop; } public boolean equals(Object obj){ return (obj instanceof Town)&&(((Town) obj).toString()).equals(this.toString()); } }...
View Full Document

This document was uploaded on 02/24/2010.

Ask a homework question - tutors are online