Create a java program using Java with LinkedLists

Create a java program using Java with LinkedLists

Assignment is --

Question

For this part of the assignment, you will develop a Java application with a simple text-based interface that will allow a user to work with a doubly-linked list representing train routes. Read through all the steps before beginning, and although there are no marks for it, we do recommend making a plan first as well.

Step 1 Your first task is to update the singly-linked list we saw in class to be a doubly-linked list. You may start with the actual code presented in class. Ensure the following requirements are met: Each list node must include a reference to the prev node All four of the linked list�s add and remove methods must update the prev reference

The copy methods must correctly copy the prev references You must add a new method to the linked list that reverses the list in place (that is, does not create a new copy of the list) Step 2 Next, you will update your linked list and list nodes.

The list itself should have a String that refers to the train route�s name . The list will now contain nodes that store information about stops along a route.

Each list node will refer to a class representing a single stop along a train route [1 mark]. Stop information should include the name and location of the stop. Information about amenities at the stop should also be included, such as whether it�s a full station or just a small shelter, whether there are washrooms available, and anything else you think is relevant . The stop should have a useful toString method , and an equals method that checks whether the stop�s name and location are equal .

In your linked list class, add at least two static methods that will each construct and return a new linked list for a specific train route . These are handy helper methods that will allow you to generate lists for testing quickly and easily.

Test all of the linked list methods with the linked lists from your static helpers in a main method inside a class called TestLinkedList .

Step 3 Now you will create a user interface class named RouteUI that follows the separated presentation design shown in class. Your user interface will know about the linked list, but your linked list must not know about the user interface (marks will be deducted if you don�t follow this).

Inside your RouteUI class, you will store an array (or ArrayList, if you prefer) of train routes In other words, you are essentially storing a list of lists.

Your RouteUI class will have a main method that, when run, will cause a text-based menu to appear with the following options Create a train route. Load default train routes. Find fastest route to stop. Quit.

When creating a train route, ask the user what the route is called, then have the user input information about stops until they type ââ?¬Å?doneââ?¬Â? . Create the linked list as the information is entered and add the route to the UI classââ?¬â?¢s list . Copy and reverse the list, add ââ?¬Å?-Reverseââ?¬Â? to its name, and add it to the UI classââ?¬â?¢s list .

Loading the default train routes means adding the routes from the static helper methods and their reverses to the UI class�s list (without overwriting the old stuff), ensuring they weren�t already there .

When the user wants to find the fastest route to a particular stop, they should be asked to name the stop and its location. Then, this information should be used to find the route that has the fewest number of stops from the beginning to the stop provided [3 marks]. If a route was found, the program will output the names and locations of the stops from the beginning to the requested stop .

Demonstrate that your UI works by testing each functionality, then save the text of your interactions and include them in a file called testing-output.txt [2 marks]. This testing file will be used somewhat to evaluate your work (though if it appears you have modified it at all after copying the text of your interactions, you will lose 50% of your marks for this part of the assignment).

Question guideLine

public class ListNode { private Scene data; private ListNode next;

public ListNode(Scene newData)
{
    this(newData, null);
}

public ListNode(Scene newData, ListNode newNext)
{
    data = newData;
    next = newNext;
}

public Scene getData() { return data; }
public ListNode getNext() { return next; }
public void setNext(ListNode newNext) { next = newNext; }

public void printListFromHere()
{
    System.out.println("----------\nStart List\n----------");
    ListNode currNode = this;
    while (currNode != null)
    {
        System.out.println("\t" + currNode.getData());
        currNode = currNode.getNext();
    }
    System.out.println("----------\nEnd List\n----------");
}

}

View Answers









Related Tutorials/Questions & Answers:
Create a java program using Java with LinkedLists
Create a java program using Java with LinkedLists  Assignment is -- Question For this part of the assignment, you will develop a Java application... that reverses the list in place (that is, does not create a new copy of the list) Step 2
program to create student report using java applet,read the input using text boxesand generate the grades..?
program to create student report using java applet,read the input using text boxesand generate the grades..?   sir plz give me java applet codes for above question
Advertisements
A Java Program by using JSP
A Java Program by using JSP  how to draw lines by using JSP plz show me the solution by using program
RARP program using java
RARP program using java   hai, how to implement the RARP concept using java
How to create first program in Java?
How to create first program in Java?  Hi, I am new in Java programming. Tell me How to create first program in Java? Thanks   Hi, Read more at First Java Program. Thanks
How to create first Java Program?
How to create first Java Program?  Hi, I am beginner and I want to write first Java program. How I can setup my machine and write first Java program... and run first Java program: Create program in Note pad: Step 1: Open
Create HTML page using java
Create HTML page using java   Hi, I need to create an html page to export some information. Currently, by using java, i've exported information to excel. But now, I would like to view it in HTML instead of excel. Is there any
LINKEDLISTS
LINKEDLISTS  HOW TO DELETE,INSERT & PRINT NODES IN LIKEDLISTS   Hi Friend, Please visit the following links: http://www.roseindia.net/java/jdk6/LinkedListExample.shtml http://www.roseindia.net/java/beginners
java program using control statements...
java program using control statements...  public class ControlStatements { public static void main(String args[]){ int x=10; if(x==0...("It is negative number"); }}} in this program what and where it is error and why
Java Program Qns using BlueJ
Java Program Qns using BlueJ  Write a program that accepts one...), showing the carry, the quotient and the remainder. The program should output... are 158 and 7, the program should output: 1 1 7) 1 5 8 0 2 2 R4 If the two
create and use an array variable in a java program
create and use an array variable in a java program  how do i write a program that will prompt the user for a list of 5 prices, once the user has entered all values , your program should compute and display the following: The sum
how to create users in LDAP using java?
how to create users in LDAP using java?  how to create users in LDAP using java
Create Excel Sheet Using JSP
create excel sheet using jsp       In this program, we are going to create the cells and rows into excel sheet using java .You can create any number of cells and rows
how to create a header in jtable using java swing
how to create a header in jtable using java swing  how to create a header in jtable using java swing   d
Create SpreadSheet same as excel using java applet
Create SpreadSheet same as excel using java applet  Hi Ji, May i know to create new excel sheet using java Applet
Create SpreadSheet same as excel using java applet
Create SpreadSheet same as excel using java applet  Hi Ji, May i know to create new excel sheet using java Applet
how to create exce sheet using java
how to create exce sheet using java  how to create excel sheet using java
how to create an excel file using java
how to create an excel file using java  how to create an excel file using java
how to create pdf file using java and itextjar
how to create pdf file using java and itextjar  How to create pdf file having paragraphs and alignments done using java and itextjar 5.10 version.? hope i get quick response
how to create pdf file using java and itextjar
how to create pdf file using java and itextjar  How to create pdf file having paragraphs and alignments done using java and itextjar 5.10 version.? hope i get quick response
How to create new arraylist using Java
How to create new arraylist using Java  hi, I want to develop... someone provides online example how to create new arraylist in java programming. thnaks,   Hi, In java programming language you can create new
how can create album in java by using Stack ....
how can create album in java by using Stack ....  hi all , if i press push button put the image to the stack , and when i press pop button remove the image ..??? please help me please
Create a Java program using XSLT APIs
Create a Java program using XSLT APIs       Now we will develop a class in Java that takes both XML...(e.getLocationAsString());   } } This program uses three
Java program using stateful session - Java Beginners
Java program using stateful session   Write a program using stateful session bean to add three numbers by accepting input from the user
Blocking a web site using java program
Blocking a web site using java program  How to block a url typed in browser using java program
Execute the java program using one processor
Execute the java program using one processor   Write a program to print the number series 1, 2,3, 4ââ?¬Â¦.100 using java programming language in dual core computer a) Execute the program using one processor b) Execute
want a program for date picker by using java swings
want a program for date picker by using java swings  to write a program for the date picker by using java swings.any one please help me by providing the code to this java date picker by using the java swings.previously a program
Computer forensic application development using JAVA program
Computer forensic application development using JAVA program  Write a computer forensic application program in Java for Recovering Deleted Files and Deleted Partitions
how to run a java program using run.exec()?
how to run a java program using run.exec()?  Hi..i want to compile and run a java file using run.exec().i.e., without compiling and running from.... can i expect a sample java program using run.exec(). Thanking you
Hibernate Simple Program Using Java Application with Eclipse
Hibernate Simple Program Using Java Application with Eclipse  How to write Hibernate Simple Program Using Java Application with Eclipse? I wish to learn Hibernate using very popular Eclipse IDE. Share me the best tutorial link
Sending and receiving xml message using Java Program
Sending and receiving xml message using Java Program  Hi Friends, I want to send and receive xml files between two java programs using wire format... sample program to understand. Thanks in advance. Regards, Atul Patil
Sending and receiving xml message using Java Program
Sending and receiving xml message using Java Program  Hi Friends, I want to send and receive xml files between two java programs using wire format... sample program to understand. Thanks in advance. Regards, Lisha Ahuja
Program using String functions - Java Beginners
Program using String functions  Write a program to accept a sentence and find out how many times the word "the" occurs?  Hi Friend, Try the following code: import java.util.*; class CountSameWords
How to Create a ByteBuffer using Byte Array in java.
How to create a ByteBuffer using Byte Array in java.      ..., we will discuss how to creates a buffer using byte array. The ByteBuffer ...; The wrap method create a byte buffer by wrapping  the associated
How to create Multiple Frames using Java Swing
Multiple Frames in Java Swing In this section, you will learn how to create multiple frames. Java Swing provides the utility to show frame within another frame by providing the class JInternalFrame. With the use of this class, you can
Create Tabs in Java using SWT
Create Tabs in Java using SWT       This Tab Example in Java, will teach you how to create tabs using SWT in Java. After going through the example you will be able to create
How to create the program in Java for getting the forgotten Password Form?
How to create the program in Java for getting the forgotten Password Form? ... to the user on email address. How to create the program in Java for getting the forgotten Password Form? Thanks   For this you should create a form
java program to create xml file with append data in well-formed
java program to create xml file with append data in well-formed   Sorry sir your given xml append data program is not well-formed. I'll make you more clear what I want. If this is my xml file Tom Cruise 45 Now when I append
Java Create Directory - Java Tutorial
Java Create Directory - Java Tutorial   ... a directory or subdirectories are created. This program also explains the process...;} } Output of the program:  C:\nisha>javac CreateDirectory.java
java source code to create mail server using struts2
java source code to create mail server using struts2  java source code to create mail server using struts2
create, edit ,open simple documents using java - Swing AWT
create, edit ,open simple documents using java   In my program I have a text area.How to create document which will contain text in text... want to use Java Swing or JSP? Do you want to create word document file
Using poi hwpf,how to create table in word document. - Java Beginners
Using poi hwpf,how to create table in word document.  Can you please tell me how to create a table in the word document in java using Apache poi hwpf.its very urgent.Please send some sample code.Thanks in advance
How to Create Excel Page Using JSP
using java .By going through the steps of  this example we can create any... using pure word files using Java. We can create, read or write MS Excel file using... how to create excel page using jsp   
how to create xml schema from xml doc using java
how to create xml schema from xml doc using java  i want to create xml schema from xml document programatically using java... am using Netbeans IDE... need to create the xml schema for that document and send both xml doc ans schema
How to Create New Excel Sheet Using JSP
How to create new excel sheet using jsp       In this program, we are going to create a new  excel sheet using java .You can create any number of  new excel
How to create a Student data base using Linked List in java
How to create a Student data base using Linked List in java  I want a program by using linked list in java. The data stored must... Record2 sandhya 22 5apr By using linked list I hve
plz help me to create gui using Java netbeans
plz help me to create gui using Java netbeans  Hi, I am unable to fetch a particular data from DB.I am using netbeans for creating GUI. If I want to fetch a particular value like '6', it is calling all the data which contains 6
Create Scroll Bar in Java using SWT
Create Scroll Bar in Java using SWT   ... SWT  The given example will show you how to create scroll bar in Java using... a package org.eclipse.swt.widgets, which is used to create ScrollBar in Java
java program to check whether a number is pallindrome or not using recursion???????
java program to check whether a number is pallindrome or not using recursion???????  java program to check whether a number is pallindrome or not using recursion
java program to check whether a number is pallindrome or not using recursion???????
java program to check whether a number is pallindrome or not using recursion???????  java program to check whether a number is pallindrome or not using recursion

Ads