Search:

Type: Posts; User: Gamb1t

Page 1 of 5 1 2 3 4

Search: Search took 0.29 seconds.

  1. Replies
    208
    Views
    4,463

    Re: Address Book Program Issues

    thanks for the help anyways, looks like i'm repeating the first year again probably for the best
  2. Replies
    208
    Views
    4,463

    Re: Address Book Program Issues

    I think thats how its meant to i really havent a clue anymore
  3. Replies
    208
    Views
    4,463

    Re: Address Book Program Issues

    i may as well just leave it not gonna get this sorted i just keep going round in circles and wasting your time
  4. Replies
    208
    Views
    4,463

    Re: Address Book Program Issues

    its the index of the last element in the list
  5. Replies
    208
    Views
    4,463

    Re: Address Book Program Issues

    It's a count of the last element in the list i think so it's to do with the number of entries/contacts not the number of data variables in each
  6. Replies
    208
    Views
    4,463

    Re: Address Book Program Issues

    I have these

    //index of the last entry
    private int top = 0;
    //constant number that indicates the maximum
    //number of entries in the address book
    private static final int...
  7. Replies
    208
    Views
    4,463

    Re: Address Book Program Issues

    Is this something different to the null thing?
    so my variable is list[top]
    so i need to use the top and that sets the amount of loops,
    i really can't think anymore
  8. Replies
    208
    Views
    4,463

    Re: Address Book Program Issues

    Okay that makes sense but where and how do i do this? Sorry my brain has melted :(
  9. Replies
    208
    Views
    4,463

    Re: Address Book Program Issues

    Contact@3bc0f2e5
    Street Address: west, City: south, County: east, Country north, Postcode: null
    Forename: phil, Surname: stone

    Contact@788ab708
    Street Address: south , City: east, County:...
  10. Replies
    208
    Views
    4,463

    Re: Address Book Program Issues

    It compiles but i get an error message when i use the method - "java.lang.NullPointerException: null"
    error message points System.out.println(top.toString());
    It's seems to show everything but it...
  11. Replies
    208
    Views
    4,463

    Re: Address Book Program Issues

    So i need
    for (Contact top : list)
    {
    System.out.println(top.toString());
    }
    ??
  12. Replies
    208
    Views
    4,463

    Re: Address Book Program Issues

    The data i want to print is all the variables from name and all the variables from address.
    All of which is found under

    Name name = new Name(forename, surname);
    Postcode postcode =...
  13. Replies
    208
    Views
    4,463

    Re: Address Book Program Issues

    So i only need to call it once as it takes care of all the variables?
    And do i then need to override it and have it with the AddressBook class too

    God i'm getting frustrated and i'm not gonna get...
  14. Replies
    208
    Views
    4,463

    Re: Address Book Program Issues

    The list variable is in the class AddressBook set as an array

    private Contact[] list;

    The toString method comes from Contact class

    @Override
    public String toString() {
    ...
  15. Replies
    208
    Views
    4,463

    Re: Address Book Program Issues

    So
    for (Contact index : list)
    {
    System.out.println(index.toString());
    }

    This says for each Contact index in list then system prints out the index...
  16. Replies
    208
    Views
    4,463

    Re: Address Book Program Issues

    I should use a for each loop shouldn't i, so for each of the data values in an index use toString and enter the value. And will need an arraylist then i imagine - it's something like this isn't it - ...
  17. Replies
    208
    Views
    4,463

    Re: Address Book Program Issues

    It seemed the only way to get it to compile.
    I require this - addressbook.viewContact(contact); so it links to addressbook and performs the function.
    And it says it can't find the variable contact....
  18. Replies
    208
    Views
    4,463

    Re: Address Book Program Issues

    Though i seem to have an issue.
    After entering 2 contacts and then requesting to view the list i got this printed for some strange reason

    Street Address: townsend croft, City: coventry, County:...
  19. Replies
    208
    Views
    4,463

    Re: Address Book Program Issues

    Sorry it's tiredness and my punctuation is going to pot.
    Correction - making silly mistakes it's fine now it will display the list


    public void viewEntries(){
    String forename = "";...
  20. Replies
    208
    Views
    4,463

    Re: Address Book Program Issues

    This just declares a Contact arraylist doesn't it , if its pointing at Contact class it shouldnt matter should it as if its declared in AddressBook it would be the same i think as it would be the...
  21. Replies
    208
    Views
    4,463

    Re: Address Book Program Issues

    I think it's looking at the Contact class:


    public class Contact
    {
    private Address address;
    private Name name;


    public Contact(Name name, Address address)
  22. Replies
    208
    Views
    4,463

    Re: Address Book Program Issues

    Damn of course i missed it.

    So now
    public void viewEntries(){
    if(addressbook.isEmpty()){
    System.out.println("Address Book is full");
    return;
    ...
  23. Replies
    208
    Views
    4,463

    Re: Address Book Program Issues

    oops good point.

    Added to Address class:


    boolean isEmpty() {
    return top = 0;
    }

    However it expects int so if i use
  24. Replies
    208
    Views
    4,463

    Re: Address Book Program Issues

    thanks,

    now onto show all entries:

    In my Contact class


    public void showContact(Contact contact)
    {
    for( int index = 0; index < top; index++)
  25. Replies
    208
    Views
    4,463

    Re: Address Book Program Issues

    So i've finally sorted out my AddressBook class i think and still sorting out the addEntry method in the Textui

    Having two issues, 1st the try{ is an unreachable statement and i can't figure out...
Results 1 to 25 of 106
Page 1 of 5 1 2 3 4