Lab 6: Circular Linked Lists
Due Date and Submission Requirements
- Due Date: Thursday, October 3rd at 11:59 p.m.
- Partner Information: This is an individual assignment. You are allowed to collaborate with other students, but each student must submit their individual, independent solution.
- Submission Instructions: Upload your solutions (.java file), entitled Node.java, and CircularLinkedList.java to the BrightSpace(D2L) Lab 6 Dropbox.
The goal of this lab is:
- Gain experience using Circular Linked Lists
- Write methods that manipulate data inside a LinkedList
Background and Directions
Indiana Jones and the Great Circle is a new video game coming out later this year. This game involves Indiana Jones visiting multiple historical landmarks around the world to stop some bad guy. If you were to draw a line through all these locations on a globe, it would form a perfect circle (hence the title "the great circle"). This gimmick seems hard to believe, but I am giving it a pass since it's Indiana Jones.
In this lab, you will use a doubly circular linked list to keep track of the different locations in the great circle. Each Node in this linked list will have the location, the continent, and the elevation (in feet) of the location. You will need to make a Node class.
The Nodes are created from an input file locations.txt, which you will then load into your linked list.
Using Lab6Demo.java as a starting point, you will need to define the necessary classes and methods so that this program produces the correct output.
CircularLinkedList.java implements the Lab6Methods interface, which tells you all the methods you need to write.
- fillLinkedList()- This method will open the correct file, create node objects from the file, and then call the append() method to add nodes to the linked list
- append(Node newNode)- This will add a Node to the linked list. The newNode will become the new tail of the circular linked list
- printLinkedList()- Prints the nodes of the linked lists from head to tail.
- search(Node newNode)- This method searches for a particular location in the linked list. If it finds the location, it should print out what spot that location is at. If the location is not found, then "(location) is not part of the great circle" should be printed out
- findGreatestElevationDifference()- This method finds the greatest difference in elevation between two consecutive Nodes in the linked list. The answer must include two consecutive nodes-- it can't be two nodes on opposite ends of the linked list.
Rules
You are NOT allowed to import java.util.LinkedList;
This must be a circular, doubly linked list
Starting Code
Required Output
When your program is run, your output should look exactlythe same as seen in this screenshot .
Grading (10 points)
- 4 points - Nodes are added to a circular linked list (append() and fillLinkedList())
- 1 point - printLinkedList() is correct
- 2 points - search() is correct
- 3 points - findGreatestElevationDifference() is correct
Deductions
-10 points if you dont use a Linked List
-100 points if you dont implement the interface