Okay.... I have been working on this for 3 days now and can not get any further than what I have.

Any help would be greatly appreciated... Thank you.

Here is what I need to do:

Write a program for keeping a course list for each student in a college. The information about each student should be kept in an object that contains the student's name and a list of courses completed by the student. The courses taken by a student are stored as a linked list in which each node contains the name of a course, the number of units for the course, and the course grade. The program gives a menu with choices that include adding a
student's record, deleting a student's record, adding a single course record to a student's record, deleting a single course record from a student's record, and printing a student's record to the screen. The program input should accept the student's name in any combination of upper- and lowercase letters. A student's record should include the student's GPA (grade point average) when displayed on the screen. When the user is through with the
program, the program should store the records in a file. The next time the program is run, the records should be read back out of the file, and the list should be reconstructed. (Ask your instructor if there are any rules about what type of file you should use.)
Note: You can use any type of file that you choose. A text file will be the easiest to demonstrate that the data is correct.


MAIN

import java.util.*;
public class TEST
{

	/**
	 * @param args
	 */
	public static void main(String[] args)
	{
		DoubleNodeLinkList_1<StudentRecord> sr = new DoubleNodeLinkList_1<StudentRecord>();
		sr.addHeadNode(new StudentRecord("Thom", 3.2, 284880847));
		sr.addTailNode(new StudentRecord("David", 4.0, 575976520));
		System.out.println();
		sr.doubleLinkListForward();
		sr.toString();
	}



}
		
class StudentRecord
{
	private String name;
	private double gpa;
	private int ssn;


	public StudentRecord(String name, double gpa, int ssn) 
	{
		name = this.name;
		gpa = this.gpa;
		ssn = this.ssn;
	}


	public String getName() {
		return name;
	}


	public void setName(String name) {
		this.name = name;
	}


	public double getGpa() {
		return gpa;
	}


	public void setGpa(double gpa) {
		this.gpa = gpa;
	}


	public int getSsn() {
		return ssn;
	}


	public void setSsn(int ssn) {
		this.ssn = ssn;
	}
}

CLASS

public class DoubleNodeLinkList_1<T>
{
	private Link head;
	private Link tail;
  
	/**
	 * Constructor
	 * @param head
	 * @param tail
	 */
	public DoubleNodeLinkList_1()
	{
		head = null; 
		tail = null;
	}

	/**
	 * isEmpty method
	 * @return head == null
	 * returns if nothing is in the node
	 */
	public boolean isEmpty()
	{
		return head == null;
	}

	/**
	 * addHeadNode method
	 * @param node, adds node
	 * to the head position
	 */
	public void addHeadNode(Object studentRecord)
	{
		Link dll = new Link(studentRecord); 

		if (isEmpty()) 
			tail = dll; 
		else
			head.prev = dll; 
		dll.next = head; 
		head = dll; 
	}

	/**
	 * addtailNode method
	 * @param node, adds node
	 * to the tail position
	 */
	public void addTailNode(T node)
	{
		Link dll = new Link(node); 
		if (isEmpty()) 
			head = dll; 
		else {
			tail.next = dll; 
			dll.prev = tail; 
		}
		tail = dll; 
	}
	
	/**
	 * removeNode method
	 * @param node1, node to be removed
	 * @return null, if node can not be found
	 * @return temp, if node was found
	 */
	public Link removeNode(T node1)
	{
	  
		Link temp = head; 
		while (temp.data != node1)
		{
			temp = temp.next;
			if (temp == null)
				return null; // cannot find it
		}
		if (temp == head) // found it; head item?
			head = temp.next; 
		else
			temp.prev.next = temp.next;
		
		if (temp == tail) // tail item?
			tail = temp.prev; 
		else
			// not tail
			temp.next.prev = temp.prev;
		return temp; // return value
	}

	/**
	 * doubleLinkListForward method
	 * print link list from head to tail
	 */
	public void doubleLinkListForward() 
	{
		System.out.print("List (head to tail): ");
		Link temp = head; // start at beginning
		while (temp != null) // until end of list,
		{
			temp.displayLink();
			temp = temp.next; // move to next link
		}
		System.out.println("");
	}
	
	/**
	 * doubleLinkListReverse
	 * print link list from tail to head
	 */
	public void doubleLinkListReverse() 
	{
		System.out.print("List (tail to first): ");
		Link temp = tail;
		while (temp != null){
			temp.displayLink();
			temp = temp.prev;
		}
		System.out.println("");
	}
	
	
	
	
	class Link<T> 
    { 
    /** 
     * constructor 
     * @param next 
     * @param prev 
     */ 
    public T data; // data item 
    Link next; // next link in list 
    Link prev; // prev link in list 

    /** 
     * Link method 
     * @param d 
     */ 
    public Link(T d) 
    { 
            data = d; 
    } 
		/**
		 * displayLink method
		 * prints the link list for:
		 * doubleLinkListForward method
		 * doubleLinkListReverse method
		 */
		public void displayLink()
   		{
   			System.out.print("[" + data + "], ");
   		}
	}
}

What, do you expect somebody to figure out what needs to be done? Why don't you explain the problem you're having?

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.