Search:

Type: Posts; User: 93tomh

Page 1 of 2 1 2

Search: Search took 0.09 seconds.

  1. Replies
    19
    Views
    1,961

    Re: finding and deleting from an array?

    I GOT IT! :D

    Thank you very much for your help and suggestions norm, it is very appreciated!
  2. Replies
    19
    Views
    1,961

    Re: finding and deleting from an array?

    so now i have



    public int findContactIndex(String firstName, String secondName)
    {
    int index = 0;
    boolean found = false;
    while(index<contactList.size() && !found)...
  3. Replies
    19
    Views
    1,961

    Re: finding and deleting from an array?

    Yes, it will be in a method of its own, and im hoping to return the name address and all the details of that entity. Am i going to be trying to say "if firstName == fName && secondName == sName" but...
  4. Replies
    19
    Views
    1,961

    Re: finding and deleting from an array?

    Im trying to work on the finding contact first. Also I dont know how to return an array list, ive been trying to understand it forages now but cant get my head around it. What annoys me about this is...
  5. Replies
    19
    Views
    1,961

    Re: finding and deleting from an array?

    I was always taught in uni to use things like 'addPersonalContact' for a method, and its what i am used to. I have reposted the account code, which i missed off the last bit by accident first time....
  6. Replies
    19
    Views
    1,961

    Re: finding and deleting from an array?

    and sorry, missed the end bit ... silly me



    private int findAccount(String accountNumber)
    {
    int index = 0;
    boolean found = false;
    while(index < accounts.size()...
  7. Replies
    19
    Views
    1,961

    Re: finding and deleting from an array?

    Would it not compile because i didnt give you the other 3 classes that are used? Because it compiles at my end perfectly.





    public abstract class Contact
    {
    protected String fName;
    ...
  8. Replies
    19
    Views
    1,961

    Re: finding and deleting from an array?

    sorry i havent replied, i tried for a couple of hours yesterday to get my head around this and got nowhere. But digging up some of my old assignments I found this piece of code, would what i am...
  9. Replies
    19
    Views
    1,961

    Re: finding and deleting from an array?

    I know that


    public String toString() {
    final StringBuilder output = new StringBuilder("All Contacts:\n");
    for (Contact contact : contactList) {
    ...
  10. Replies
    19
    Views
    1,961

    Re: finding and deleting from an array?

    I want to search by first and last name, im guessing for finding a contact;

    1. returning the full array list and then sorting the results by name
    or
    2. Searching through the array list only for...
  11. Replies
    19
    Views
    1,961

    finding and deleting from an array?

    Ok, so im struggling to find a 'contact' and also deleting a 'contact' in my array list. Can anyone tell me how i can do this? Thanks



    import java.util.ArrayList;

    public class ContactList
    {...
  12. Replies
    16
    Views
    1,569

    Re: Having trouble returning an array

    Can you show me the syntax for a comparator class? Ive looked online for it and im not sure how to write this. Im not asking for you to write any code, but can you put it in sort of laymans terms...
  13. Replies
    16
    Views
    1,569

    Re: Having trouble returning an array

    All of the data are strings that are set in a different class.
  14. Replies
    16
    Views
    1,569

    Re: Having trouble returning an array

    I just dont know how to sort arrays by a certain string in them.

    So there are 2 different contact types (called contactType and is a String) These are automatically assigned when you call either...
  15. Replies
    16
    Views
    1,569

    Re: Having trouble returning an array

    I have 2 different contact types- Personal and Business. I need to return both business and personal contacts seperately. I dont know why i said pull back, i meant return, my mind must have gone...
  16. Replies
    16
    Views
    1,569

    Re: Having trouble returning an array

    Thank you very much! And can i ask you for the syntax to pull back data in the array that has either the "personal" or "business" contact type?
    Thanks again
  17. Replies
    16
    Views
    1,569

    Re: Having trouble returning an array

    1356

    and im not certain about the variable, i didnt really know how to return an array at all, but i have another project that compiles fine with it and i tried to convert it to use it in this...
  18. Replies
    16
    Views
    1,569

    Re: Having trouble returning an array

    ]CODE]public String toString()
    {
    String output = "All Contacts:\n";
    for (ContactList contact : contactList)
    {
    output = output + account + "\n\n" ;
    ...
  19. Replies
    16
    Views
    1,569

    Having trouble returning an array

    Below is a my code, and i have got as far as creating the arrays, but im not too sure how to return them. I have made an effort but got the compiling error: incomplatible types. I have hilighted this...
  20. Replies
    6
    Views
    1,168

    Re: toString problem

    Fantastic! Thank you very much, seems obvious to me now haha. And dont worry, its my fault for thinking that little snippets would be enough for someone to see what was wrong with my code

    Thanks a...
  21. Replies
    6
    Views
    1,168

    Re: toString problem

    Sorry, i thought those parts of the code were sufficient. Here are the full classes.




    public class Contact
    {
    protected String fName;
    protected String sName;
    protected String...
  22. Replies
    6
    Views
    1,168

    Re: toString problem

    I dont have a static void main() in any of my classes, is this the reason it is not working, or am i completely off the ball. Sorry I'm not too great with java but im trying to understand it
  23. Replies
    6
    Views
    1,168

    [SOLVED] toString problem

    Hi, i need to call a toString method in another one of my toString methods, however i am getting a compiling erroe each time, can anyone look at the code below and let me know what i have done wrong?...
  24. Replies
    2
    Views
    1,251

    How do I return an array list?

    Ok, so to ensure everything is working ok, i want to be able to return my data from my array list. The code is below and if anyone can tell me how i could return the data (preferabley by printing it....
  25. Replies
    11
    Views
    1,964

    Re: Trouble with an array

    Instead of using the constructor, I was thinking of using

    public void createPersonal(orBusiness)Class()

    But i do not know how to call this in the array list
Results 1 to 25 of 42
Page 1 of 2 1 2