Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 10 of 10

Thread: need help guys

  1. #1
    Junior Member
    Join Date
    Dec 2009
    Posts
    9
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default need help guys

    Part 1. The basic classes and addAddress method
    Create a class called Address that has two fields representing the name and the email address.
    Write a constructor for this class.
    Create a class called AddressBook that uses Address. The address book should contain a collection of addresses.
    Within the AddressBook class, write a constructor and a method to add a new address to the address book.
    Part 2. Listing and changing addresses
    For both of these methods to work, you need to write additional methods in the Address class.

    Write a method that prints out all addresses in the address book along with their index. For example, this method may print out the following:
    [0] William w.w.timms@elsewhere.edu
    [1] Thomas t.example@gmail.co
    [2] Briony briony.s@xyz.com
    [3] Albert albert@somewhere.org
    [4] Barbara b.scott@tsbs.au
    Write a method that allows the user to change the email stored in an address at a specific index. For example a method call such as this
    changeEmail(1,"t.example@gmail.co.uk")
    will result in a change to the information stored in your address book to:
    [0] William w.w.timms@elsewhere.edu
    [1] Thomas t.example@gmail.co.uk
    [2] Briony briony.s@xyz.com
    [3] Albert albert@somewhere.org
    [4] Barbara b.scott@tsbs.au
    Part 3. Deleting and checking addresses
    Write a method that allows the user to delete an address stored at a specific index. For example, if the addressbook contains the list of addresses used as an example above in 2(a), after this instruction is executed:
    deleteAddress(2)
    the address book will contain the following:
    [0] William w.w.timms@elsewhere.edu
    [1] Thomas t.example@gmail.co
    [2] Albert albert@somewhere.org
    [3] Barbara b.scott@tsbs.au
    Adapt your solution so that emails are checked when new addresses are added or emails are changed so that they at least contain an '@' character.
    Part 4. Searching and Listing by First Letter
    Write a method to list all addresses where the name field starts with a single character; the signature of the method should be as follows:
    void listNamesStartingWith(char c)
    If this method is called in the following way with the addressbook list shown above in 2(a)
    listNamesStartingWith('B')
    it will display
    [2] Briony briony.s@xyz.com
    [4] Barbara b.scott@tsbs.au
    and if is called in the same way with the addressbook list shown above in 3(a) it will display
    [3] Barbara b.scott@tsbs.au
    Write a method to search for and print out all addresses containing a string. The search should look for the string in either the name or the email address.


  2. #2
    mmm.. coffee JavaPF's Avatar
    Join Date
    May 2008
    Location
    United Kingdom
    Posts
    3,336
    My Mood
    Mellow
    Thanks
    258
    Thanked 294 Times in 227 Posts
    Blog Entries
    4

    Default Re: need help guys

    What do you need help with exactly? People will not complete assignments for you.

    Please post what code you have and we can help you move forward.
    Please use [highlight=Java] code [/highlight] tags when posting your code.
    Forum Tip: Add to peoples reputation by clicking the button on their useful posts.

  3. #3
    Junior Member
    Join Date
    Dec 2009
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: need help guys

    Objects First
    Object Behaviour
    Class Definitions
    Object Interaction
    Grouping Objects: Introduction to Collections
    Documenting Code
    Grouping Objects: Collections and Loops
    Grouping Objects: Iterators
    Revision of Concepts
    Grouping Objects: Arrays
    Logic
    Elimination, Implication, and Deduction
    Bits, Characters and Strings
    Logical Inference
    Sets and More User Interaction
    Sets and Logic


    something like these..


    Some Help Please
    Last edited by alonino; December 2nd, 2009 at 11:04 PM.

  4. #4
    Super Moderator helloworld922's Avatar
    Join Date
    Jun 2009
    Posts
    2,896
    Thanks
    23
    Thanked 619 Times in 561 Posts
    Blog Entries
    18

    Default Re: need help guys

    That's a very large list of things. If you have a textbook for the class, I'd suggest reading through it, or you can look at Java Classes and Objects Lesson.

    If you have any specific questions, ask us. Oh, and by reading through the requirements for your program, I don't think it's a set that you want, but rather an array. If your teacher will allow it, use an ArrayList. They are basically arrays, but they have extra code that makes expanding them very easy. You can read about Java Arrays here if your teacher won't let you use ArrayLists.

  5. #5
    Junior Member
    Join Date
    Dec 2009
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: need help guys

    Very thanks.. We are able to use ArrayLists .. i will try to do this :/

  6. #6
    Junior Member
    Join Date
    Dec 2009
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: need help guys

    Nothing yet... :/ I will fail

  7. #7
    Super Moderator helloworld922's Avatar
    Join Date
    Jun 2009
    Posts
    2,896
    Thanks
    23
    Thanked 619 Times in 561 Posts
    Blog Entries
    18

    Default Re: need help guys

    What do you have?

  8. #8
    Junior Member
    Join Date
    Dec 2009
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: need help guys

    nothing...i cant do that addressbook :/

  9. #9
    mmm.. coffee JavaPF's Avatar
    Join Date
    May 2008
    Location
    United Kingdom
    Posts
    3,336
    My Mood
    Mellow
    Thanks
    258
    Thanked 294 Times in 227 Posts
    Blog Entries
    4

    Default Re: need help guys

    I'm sorry alonino but there is no way we are going to complete all of this for you. You obviously haven't left enough time to finish this work. To get help you need to show us the steps you have taken to complete this work yourself. At least show us your basic classes so we can help you move forward.

    If you are really desperate, I suggest you post in the 'paid projects' forum and hire someone to do this work for you.
    Please use [highlight=Java] code [/highlight] tags when posting your code.
    Forum Tip: Add to peoples reputation by clicking the button on their useful posts.

  10. #10
    mmm.. coffee JavaPF's Avatar
    Join Date
    May 2008
    Location
    United Kingdom
    Posts
    3,336
    My Mood
    Mellow
    Thanks
    258
    Thanked 294 Times in 227 Posts
    Blog Entries
    4

    Default Re: need help guys

    A quick search of the forums brought up this code. It may help you get started..

    /*--------------------------------------------------------------------------
     
    AdressBookConsoleDemo class
     
     ***************** 
    Version: 07/07/2008
     
    "*****************
     
    Note: add, edit and searching the addressbook
     
    //----------------------------------------------------------------------*/
     
    public class AdressBookConsoleDemo {
     
    static int hold = 1;
     
    static String[][] addressBookHolder = new String[10000][4];
     
     
     
    public static void main(String[] args){
     
    AdressBookConsoleDemo ABCD = new AdressBookConsoleDemo();
     
    ABCD.addEntry("Mr. ", "Ben", "1111111111", "Javaprogrammingforums.com");
     
    ABCD.addEntry("Mr. ", "Javaforums", "0000000000", "Java-forums.net");
     
    ABCD.addEntry("Mr. ", "Duke", "+00 123456", "World");
     
    ABCD.addEntry("Mr. ", "Someone", "+0012233", "right here!");
     
     
     
    System.out.println("Addressbook: ");
     
    ABCD.showAddressBook();
     
     
     
    System.out.println("Edited addressbook: ");
     
    ABCD.editEntry(3, "Mr. ", "Duke nukem", "+00 123456", "Behind pc");
     
    ABCD.showAddressBook();
     
     
     
    System.out.println("Select one person from addressbook: ");
     
    ABCD.showAddressBook(2);
     
     
     
    System.out.println("Search one person from addressbook: ");
     
    ABCD.searchAddressBook("Ark");
     
    ABCD.searchAddressBook("JavafDorums");
     
    }
     
     
     
    public void addEntry(String salutation, String name, String telephoneNumber, String address){
     
    addressBookHolder[hold][0] = salutation;
     
    addressBookHolder[hold][1] = name;
     
    addressBookHolder[hold][2] = telephoneNumber;
     
    addressBookHolder[hold][3] = address;
     
    hold++;
     
    }
     
     
     
    public void editEntry(int id, String salutation, String name, String telephoneNumber, String address){
     
    addressBookHolder[id][0] = salutation;
     
    addressBookHolder[id][1] = name;
     
    addressBookHolder[id][2] = telephoneNumber;
     
    addressBookHolder[id][3] = address;
     
    }
     
     
     
    //delete an entry from the addressbook
     
    public void deletEntry(String name){}
     
     
     
    public void showAddressBook(int id){
     
    System.out.println();
     
     
     
    System.out.println("Record number: " + id);
     
    System.out.println( "Salutation: " + addressBookHolder[id][0] +  "\n" +
     
    "Name: "+ addressBookHolder[id][1] +  "\n" +
     
    "TelephoneNumber: "+ addressBookHolder[id][2] +  "\n" +
     
    "Address: " + addressBookHolder[id][3]);
     
    System.out.println();
     
    }
     
     
     
    public void showAddressBook(){
     
    System.out.println();
     
    for ( int i = 1; i < addressBookHolder.length; i++){
     
    if(addressBookHolder[i][0] !=null){
     
    System.out.println("Record number: " + i);
     
    System.out.println( "Salutation: " + addressBookHolder[i][0] +  "\n" +
     
    "Name: "+ addressBookHolder[i][1] +  "\n" +
     
    "TelephoneNumber: "+ addressBookHolder[i][2] +  "\n" +
     
    "Address: " + addressBookHolder[i][3]);
     
    System.out.println();
     
    }
     
    }
     
    }
     
     
     
    //searchAddressBook is broken when there are no results. I didn't bothered myself to fix this.
     
    public void searchAddressBook(String name){
     
    int search = 1;
     
     
     
    for ( int i = 1; i < addressBookHolder.length; i++){
     
    try{
     
    if(addressBookHolder[i][1].equals(name)){
     
    showAddressBook(search);
     
    break;
     
    }
     
    }
     
    catch(NullPointerException NPE){}
     
    search++;
     
    }
     
    }
     
     
     
    }
    Please use [highlight=Java] code [/highlight] tags when posting your code.
    Forum Tip: Add to peoples reputation by clicking the button on their useful posts.

Similar Threads

  1. [SOLVED] Some important questions about java programming
    By chronoz13 in forum Java Theory & Questions
    Replies: 12
    Last Post: April 16th, 2009, 02:55 PM