Linked List: Fall 2023

24 Oct 2023 - 17:02 | Version 1 |

Learning Objective(s)

  1. Learn to implement and use linked lists

Overview of the Program

This lab will help with the final lab. You are to write a program to build and maintain a "worm" via a linked list. A worm is made up of segments. Each segment has an address (row and column) and must be in a row/column with the segment before it and in a row/column in with the segment after it.

We will use the direction keys associated with vi to move the worm. h is for left, j is for down, k is for up, and l is for right. There are also four other "commands": + to add a segment on at the end of the worm, - to delete the first segment of the worm, = to display the worm, and q to quit.

Specifics

  • This program is to be solely text based (for now).
  • The worm starts out with 6 segments with the head at 10, 10 and the segment in a column below it.
  • The worm is allowed to move anywhere (there is no "limit" to what the row or column can be).
  • A worm also has a color that should be gotten from the user when it is first created
  • The main method should be found in a program called WormDriver
  • The input should be via command line argument .
  • You must use a linked list.
  • You should have the following classes:
    • Segment
    • Lnode
    • LinkedList. This can be any of the four types of linked lists we covered in class. You are allowed to maintain a direct link to the last item in the list.
    • Worm
  • The design (UML and testing plan) should be done before starting to code. However, this is a one week lab and you will only be turning in a software
  • create a zip folder containing only the following (and submit it)
    • only one file (as a pdf) with the completed software development report
    • all the .java files needed to run the program
    • any input files you might want to have the grader use when running the program

Optional improvements

None this week.
This site is powered by FoswikiCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding Foswiki? Send feedback
This website is using cookies. More info. That's Fine