I have a loadFromFile methods that loads in the file correctly but I can't figure out how to scan the first line in the file, store that in a variable then scan the rest using a delimiter and a while...
Type: Posts; User: PeskyToaster
I have a loadFromFile methods that loads in the file correctly but I can't figure out how to scan the first line in the file, store that in a variable then scan the rest using a delimiter and a while...
I need to create a LinkedList out of the given strings and as I am adding them sort the entries alphabetically and get rid of duplicates. I got it to not add duplicate strings but I can't figure out...
I have another problem. First here's the code snippet. It's just general code for analysis
for (j=0; j<2n; j++) {
i = 1;
Generic Statement;
while (j<n) {
Generic...
How do I analyze a for loop that looks like
for (j = 0; j < 2*n; j += 2)
I know that if it was just j++ it would loop 2n times but the += is throwing me off. This loop is nesting in a normal...
I am testing a nextDate() and prevDate() methods which increment a SimpleDate object and for testing purposes I am running it 400 times with a for loop. For both tests the for loop is the same but ...
I got the above to work but it prints it out all on one line which I can fix. I have a distance method to find the distance between to inputted zip codes
public int distance (int zip1 , int...
I see that it skips right to null but I need to have it there somewhere. I know that I was missing an i++ to keep it going along the while loop. What should I return at the end and where in the loop?...
I now have
public ArrayList search(String str) {
ArrayList<ZipCode> searchList = new ArrayList<ZipCode>();
int i = 0;
while (i < list.size()) {
...
This is a different method from the first question. I posted the new method I needed help on, on the first page. It seems it is not adding the found Zip Codes to the array list
This code is supposed to search through the list of zip codes by city or state and add the ones that match to an arraylist then return that arraylist. So if I type in "new" it should return NEWARK...
It only returns two empty brackets []. I am just assuming that it is correctly finding the values and something is wrong with adding it into the searchList
When I commented out the null it worked correctly and found the right zip code. But I need to return null if the (int zip) that is inputted is not on the list of zip codes or isn't a valid response....
What do I need to do to fix this? I thought the i++ would send it through the for loop until it reaches list.size().
EDIT: By removing the null I can get it to search through the list and find...
Why is it only comparing to the first one?
I'm am testing out a method called
public ZipCode findZip (int zip) {
ZipCode p = new ZipCode(0);
for(int i = 0; i < list.size(); i++) {
if...
I am creating an Array List of zip codes (29000 of them) and I am having trouble getting it to add the complete zipcodes to the arrayList. I think my problem is actually using the ArrayList because...