• Post Reply Bookmark Topic Watch Topic
  • New Topic

Java Assignment to Get User Input and Display ZIP Codes and Populations  RSS feed

 
Noah Stahl
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here are the instructions: http://imgur.com/WxAEE18,TP2FVVU
Here are the files used in the project: https://gist.github.com/efaf5ba5d177d6344b3a.git

So the problem is that when I type in "PA" it will display about 24 Zips and Populations before it stops. The problem is in the ZIPs file. It goes down the list and then takes the Zip from the Zips file to the Zips in the Population file and displays the Population. It will go to population 513 and stop. Reason being, there is no ZIP code in the Population file to display a population. The loop then stops. How can I get the program to skip over the zip code when there is no corresponding ZIP code in the other file and continue showing the other Pops


Here's what I currently have completed:


File 2:
 
Junilu Lacar
Sheriff
Posts: 11493
180
Android Debian Eclipse IDE IntelliJ IDE Java Linux Mac Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
On line 53, are you sure you want to split by ","? I don't see any commas in your Population file.
 
Noah Stahl
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Junilu Lacar wrote:On line 53, are you sure you want to split by ","? I don't see any commas in your Population file.


Yes. It's a CSV file. Separating by a comma does in fact work
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!