Online Training Spring Hibernate Training in Delhi R Programming Training Course Big Data and Hadoop Training Java Training  
 

Create a java program using Java with LinkedLists

Ads

 
 

Share on Google+Share on Google+

r k GAUR
Create a java program using Java with LinkedLists
0 Answer(s)      2 years and 8 months ago
Posted in : Java Beginners

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----------");
}

}

Ads
View Answers
Ads









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
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
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 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
how to create users in LDAP using java?
how to create users in LDAP using java?  how to create users in LDAP using java
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
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 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
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
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
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
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
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
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
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
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
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
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
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...;} } This program uses three arguments to take inputs from the command line
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
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