Search:

Type: Posts; User: PeskyToaster

Search: Search took 0.12 seconds.

  1. Replies
    0
    Views
    890

    [SOLVED] Using Scanner to read in text files

    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...
  2. Replies
    1
    Views
    767

    addInOrder LinkedList

    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...
  3. Replies
    4
    Views
    674

    Re: Big O - Algorithm Analysis

    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...
  4. Replies
    4
    Views
    674

    Big O - Algorithm Analysis

    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...
  5. Replies
    1
    Views
    568

    For loop Driver Testing

    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 ...
  6. [SOLVED] Re: Reading file and adding it to an array through a method

    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...
  7. [SOLVED] Re: Reading file and adding it to an array through a method

    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?...
  8. [SOLVED] Re: Reading file and adding it to an array through a method

    I now have


    public ArrayList search(String str) {

    ArrayList<ZipCode> searchList = new ArrayList<ZipCode>();
    int i = 0;
    while (i < list.size()) {
    ...
  9. [SOLVED] Re: Reading file and adding it to an array through a method

    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
  10. [SOLVED] Re: Reading file and adding it to an array through a method

    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...
  11. [SOLVED] Re: Reading file and adding it to an array through a method

    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
  12. [SOLVED] Re: Reading file and adding it to an array through a method

    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....
  13. [SOLVED] Re: Reading file and adding it to an array through a method

    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...
  14. [SOLVED] Re: Reading file and adding it to an array through a method

    Why is it only comparing to the first one?
  15. [SOLVED] Re: Reading file and adding it to an array through a method

    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...
  16. [SOLVED] Reading file and adding it to an array through a method

    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...
Results 1 to 16 of 16