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 4 of 4

Thread: Creating pseudo code

  1. #1
    Member
    Join Date
    Dec 2012
    Location
    Detroit Mi
    Posts
    122
    My Mood
    Amazed
    Thanks
    14
    Thanked 0 Times in 0 Posts

    Default Creating pseudo code

    I'm creating psudeo code to help me write a Lab that i have to create.


    Create a program that keeps track of the following information input by the user:
    First Name, Last Name, Phone Number, Age

    Now - let's store this in a array that will hold 10 of these contacts. We will be storing the information for each contact in an object called Contact
    You should be able to add, remove and edit contacts in the array.

    Here is what I have so far. I hope you guys can help me fill in the blanks.


    Pseudo Code
    Gather the information about the contact

    Create a scanner object;
    Create a 4 X 10 array;

    Ask the user for input i.e. first name, last name, phone number & Age
    Create a new contact with the information from the user
    Contact contact = new Contact(firstName, LastName, PhoneNumber, Age);
    Put the Contact into the array
    ….
    ….
    ….
    ….
    ….
    I guess my class array would be used for collecting the contact array. Is this right so far?


  2. #2
    Super Moderator jps's Avatar
    Join Date
    Jul 2012
    Posts
    2,642
    My Mood
    Daring
    Thanks
    90
    Thanked 263 Times in 232 Posts

    Default Re: Creating pseudo code

    "I guess my class array would be used for collecting the contact array. Is this right so far?" --I do not understand exactly what you are asking with this question. If that question is "Do I store my 10 Contact objects in an array?" Then the answer is yes.
    I do not agree with creating a 4x10 array. You need only a single dimensional array that holds ten of type Contact. Each Contact object will hold it's four respective values (the way you have shown in your pseudo code).

  3. #3
    Member
    Join Date
    Dec 2012
    Location
    Detroit Mi
    Posts
    122
    My Mood
    Amazed
    Thanks
    14
    Thanked 0 Times in 0 Posts

    Default Re: Creating pseudo code

    Jps,

    okay if i create a 1 dimensional array and use a New contact object. How would I create a new contact object without hard coding it? Wont I have to manually hard code a new contact object?

  4. #4
    Super Moderator jps's Avatar
    Join Date
    Jul 2012
    Posts
    2,642
    My Mood
    Daring
    Thanks
    90
    Thanked 263 Times in 232 Posts

    Default Re: Creating pseudo code

    No, there would be no reason to hard code any Contact object.
    Set up an array to hold 10 Contact objects.
    Get the four values from the user.
    Create a Contact object using the four values.
    Add the object to the array.
    repeat

Similar Threads

  1. [SOLVED] How to convert this pseudo code into JAVA
    By MUSKAAN DUTT in forum What's Wrong With My Code?
    Replies: 1
    Last Post: March 2nd, 2013, 09:36 AM
  2. pseudo code and algorithms
    By oonagh in forum What's Wrong With My Code?
    Replies: 6
    Last Post: December 3rd, 2012, 11:23 AM
  3. i need explanation in pseudo code
    By abood1190 in forum Loops & Control Statements
    Replies: 7
    Last Post: June 20th, 2012, 11:02 AM
  4. pseudo Code Help
    By shamil max in forum Java Theory & Questions
    Replies: 1
    Last Post: March 27th, 2012, 09:08 AM
  5. HELP WITH PSEUDO CODE
    By pronk123 in forum Member Introductions
    Replies: 0
    Last Post: December 14th, 2010, 09:30 AM