Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Java help.......... please

Options
  • 13-11-2001 7:03pm
    #1
    Registered Users Posts: 2,681 ✭✭✭


    I need help to write a program about Student Records in a linked list.

    Student Record has ---> surname, firstname, course, year, age,id ca, ex...

    Four Classes ....

    1. Main Class
    Methods-> Usual ****e

    2. Class Linked list
    Methods-> public LinkedList()
    public void clear()
    public boolean isEmpty()
    public Node getHead()
    public int length()
    public void insert(int index, Object obj)
    public void remove(int index)
    public Node nodeAt(int index)

    3. Class Node
    Methods-> public Node(Object e, Node n)
    public void setElement(Object newElem)
    public void setNext(Node newNext)
    public Object getElement()
    public Node getNext()

    4. Class StudentRec
    Methods-> StudentRec // constructor
    getSurname, getFirstname etc..//accessor methods



    I need Help to write Methods that will

    Sort the Surname
    static void doSortBySurname() //Sort the list based on surnames.

    find the Surname
    static void doFindBySurname()//Find a particular student (based on surname) – the line following this command contains the surname to be used.

    Delete the surname
    static void doDeleteBySurname() //Delete a record (based on surname) – the line following this command contains the surname to be used.


    thanks.............


Comments

  • Registered Users Posts: 1,481 ✭✭✭satchmo


    Hmmm... any specific questions? Well a few pointers:

    Sort by Surname - There's a good page
    here that explains a few different ways of sorting lists. Mergesort is a good one for linked lists, but you'll probably want an easier one like Selection Sort.
    Find by Surname - Just loop through the list and check each Node's Object for it's surname. You'll have to cast back to StudentRec first though.
    Delete by Surname - Once you find it as above, remove it's node from the list.

    I'm sure people will point out that posting up homework in its entirety won't get you many constructive replies. Show some effort and anyone who can will help with questions about specific programming bits.


  • Registered Users Posts: 2,281 ✭✭✭DeadBankClerk


    import boards.homework.*;

    public class FirstYear extends LeavingCert implements Assignment
    {
    }


    (this was me last year :)


  • Registered Users Posts: 2,681 ✭✭✭Johnny_the_fox


    I wasnt lookin for some man to write it for me....

    Just pointers


    thanks Jazz..... that was helpful (Seriously)


  • Posts: 0 ✭✭ [Deleted User]


    gettin to the level where you can actually get constructive help from sun.com and other sites can be really tough with java though, as u've seen from my previous problems. but u can still ask qs if u try b4hand right? pwease?


  • Registered Users Posts: 16,413 ✭✭✭✭Trojan


    We are very willing to help, you just need to ask the right things.

    Al.

    Don't say:
    I need to do X. Please help.

    Do say:
    I need to do X. What I reckon is that in order to do that, I need to do A, B and C, and possibly D.

    I don't have a clue where to start with A, what do I need to do?

    or:
    I'm in the middle of coding Y, and it's not working, I need some help with my design. Here are my assumptions, what's wrong with them?

    1.
    2.
    3.


  • Advertisement
  • Registered Users Posts: 2,660 ✭✭✭Baz_


    Nice trojan, that should be posted here always, like an announcement or something, or a special programming FAQ.

    g'man


  • Registered Users Posts: 2,681 ✭✭✭Johnny_the_fox


    What about doin an announcement with recommended sites (which would be in plain English or even Irish) that will help the amateur Java programmer with the different topics such as linked lists etc…..?


  • Registered Users Posts: 2,660 ✭✭✭Baz_


    what about using a search engine to find your own until that happens.

    www.programmingtutorials.com

    should have a few good links on it.


  • Registered Users Posts: 7,468 ✭✭✭Evil Phil


    You could join IJUG They're good for links, questions etc. Same rules apply there that apply here, we won't right your code for you :D


Advertisement