AP Java Assignment 13.5:
A Simple Linked List Class

Steps to completing the assignment

  1. Set up a RealJ project for the following application. Choose File | New
  2. Choose RealJ project
  3. Choose Application project and name the main class ApJava135
  4. Paste the following code over the code that RealJ automatically generates:
    
    public class ApJava135
    {
    
    	public static void main(String args[])
    	{
    		SimpleList theList = new SimpleList();
    		theList.addFront(1);
    		theList.addFront(2);
    		theList.addFront(3);
    		theList.display();
    		theList.remove(5);
    		theList.display();
    		theList.remove(2);
    		theList.display();
    		theList.remove(1);
    		theList.display();
    		theList.remove(3);
    		theList.display();
    
    	}
    }
    
    class SimpleList
    {
       private NumberNode head;
       public SimpleList()
       {
    
       }
       public void addFront(int nNum)
       {
    
       }
       public void display()
       {
          System.out.println("Displaying the nodes");
    
       }
       public void displayNodes(NumberNode node)
       {
    
       }
       public void remove(int nNum)
       {
    
       }
    }
    
    class NumberNode
    {
       public NumberNode(int nNum, NumberNode next)
       {
    
       }
       public NumberNode getNext(){. . . .}
       public void setNext(NumberNode next){. . . .}
       public int getNum(){. . .}
       private int myNum;
       private NumberNode myNext;
    }
    
    /* Sample Output
    Displaying the nodes
    3
    2
    1
    Displaying the nodes
    3
    2
    1
    Displaying the nodes
    3
    1
    Displaying the nodes
    3
    Displaying the nodes
    Exit code: 0
    No Errors*/
  5. Complete the application so that it produces the indicated output. Email your java code to mrsimon@lycos.com.