1. Create a doubly linked circular list in Java. Each element in the list contains a data which is an object of a Student class and two links, next and previous.
2. The Student class contains two class fields only:
• name - The first and last names are in one string
• id – It is a string number generated when insert the object into the list. It must be a unique number.
3. The circular list class is defined as following:
1) The class name is CircularList.
2) The class has two class fields only:
• cursor (Link) - always point to the current element in the list
[Note: There is no ‘first’ in the list and don’t define another pointer ‘current’. The ‘cursor’ is the ‘current’.]
• size (int) – the number of elements in the list
3) The list is doubly linked and unordered.
4) The list has no head and no tail.
5) The cursor is null if the list is empty.
6) If the list contains only one element e1, the cursor refers to e1, and the next and previous of e1 point to e1 itself.
7) If the list contains two elements e1 and e2, the next and previous of e1 point to e2, and the next and previous of e2 point to e1.
8) The operations (methods) of the class are:
• void add (Student s) – add a new element after the node pointing by cursor
• Link remove (int key) – remove the element in which the id of the object matches the given key. The method returns null if the key is not found; otherwise it returns the node of the removed element. After this operation, the ‘current’ should stay at the node before or after the deleted node, or back to the original node for ‘not found’ case.
• Link search (int key) – search an element by the given key (an id). The method returns null if the key is not found; otherwise it returns the node of the element. After this operation, the ‘current’ should point to the ‘found’ node, or back to the original node for ‘not found’ case.
Note: for ‘remove’ and ‘search’, don’t use extra pointer to go through the list. The ‘current’ is for doing the works.
9) You may define other methods like isEmpty( ) and toString( ) in the class.
4. Write a data management system to manage a Student list by using the circular list created in step 1. This program displays a menu list to allow the user to add, remove, search and display the data in the system, or quit from the system. The system should continue to serve the user till the user select to quit. The system should prompt the user properly for any input and operation results.
[Hint: For inserting a new record into the list, get the data (name and id) from user, create an object of Student, and then use add() method to insert.

Recommended Answers

All 4 Replies

Nobody is going to do your hw, go away

i juz joined in...juz checkin this sie...dont even need helpp

you seem to even need help typing...
Best start again at kindergarten.

i juz joined in...juz checkin this sie...dont even need helpp

  1. We strongly encourage all posts to be in full-sentence English.
  2. We only give homework help to those who show effort
  3. I'm not sorry at all that and we would be glad if we could get rid of lazy people like you and it would be even better if instead of solving homework could discuss interesting projects you either work on or would like

So all-in-all you better earn respect of community instead of insulting with your request and rude comments

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.