This preview shows pages 1–2. Sign up to view the full content.
This preview has intentionally blurred sections. Sign up to view the full version.View Full Document
Unformatted text preview: (y or n) If ‘y’, solicit and capture next two-character code and loop back to compare this two-character code with object state abbrevs. Else Leave this block of code Terminate program Class State – for state objects. Instance variables (to start with) String stateName String stateCapital String stateAbbreviation Int statePopulation Constructor public State (String stringFromFile) stateName = stringFromFile.substring(0,…whatever).trim(); stateCapital = stringFromfile.substring(whatever…whatevermore).trim(); same for abbreviation statePopulation = Integer.parseInt.substring(………).trim(); end state constructor public String toString() String outputString; Build string to be printed via System.out. return this String (outputString) to main for the System.out.println. end toString() public String getstateAbbreviation() return stateAbbreviation; end getstateAbbreviation()...
View Full Document
This note was uploaded on 07/26/2011 for the course COP 2551 taught by Professor Roggio,r during the Summer '08 term at UNF.
- Summer '08