Results 1 to 3 of 3
  1. #1
    shandana is offline Member
    Join Date
    Mar 2016
    Posts
    1
    Rep Power
    0

    Question Help with ArrayLists for extremely confused noob

    I am trying to develope a program with the following criteria. I've read the book and asked professor for help, but never got a reply. I know that I'm going to need to make a ArrayList as well as use swtich, but not sure where to start. I'm using my materials but only get more confused. Can someone explain what I'm supposed to do here? I'm not asking for exact code, but maybe a better explanation of what I need to do. Here is a small portion of what I'm trying to attempt:

    B. Create a program that converts the array of Strings shown above to an ArrayList of Student objects. For the Student object class, do the following.
    1. Include the following instance variables that describe each student:
    student ID
    first name
    last name
    e-mail address
    age
    array of grades
    2. Include the following methods in the Student class:
    a. an accessor (i.e., getter) for each instance variable from part B1
    b. a mutator (i.e., setter) for each instance variable from part B1

  2. #2
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    14,422
    Blog Entries
    7
    Rep Power
    28

    Default Re: Help with ArrayLists for extremely confused noob

    Think of it: each String in your array should contain enough information to build a Student object from (e.g. ID, first name, last name etc). You should build a method that disects a String in useable parts and builds a single Student object out of it; once you have that method, the rest is peanuts:

    Java Code:
    List<Student> students= new ArrayList<Student>();
    for (String studentString : stringArray)
       students.add(yourBuildingMethod(studentString));
    kind regards,

    Jos
    Build a wall around Donald Trump; I'll pay for it.

  3. #3
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    13,541
    Rep Power
    26

    Default Re: Help with ArrayLists for extremely confused noob

    Have you created the Student class?
    That would be my first step.
    Just handle B1 and ensure it compiles.
    Nothing more.
    Then do B2.
    No point worrying about the conversion stuff until you have the basic blocks in place.
    Please do not ask for code as refusal often offends.

    ** This space for rent **

Similar Threads

  1. Replies: 3
    Last Post: 03-05-2014, 11:01 AM
  2. EXTREMELY simple question
    By T.J. in forum New To Java
    Replies: 13
    Last Post: 09-23-2011, 07:02 PM
  3. Digit sum of extremely large numbers
    By sunde887 in forum New To Java
    Replies: 2
    Last Post: 01-26-2011, 11:00 PM
  4. Extremely fast applet
    By FerretSpy440 in forum Java Applets
    Replies: 0
    Last Post: 07-17-2009, 05:12 AM
  5. Help im a noob.. a super noob on java..
    By critdevil in forum New To Java
    Replies: 12
    Last Post: 03-07-2009, 04:17 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •