For this homework you will write simulators for Jumping Jen and Jumping Jill.Copy Jumper.java from /home/gtowell/Public206/a5 into a directory for this assignment. Use the function jump in the Jumper class to determine the direction and distance of Jen and Jill's jumps. (As documented in the Jumper class, -1 means jump backward; a posivive number indicates the distance to jump forward.)
Write a linked list based implementation for stack and queue using the stack and queue interfaces discussed in class. You might start from the single linked list or double linked list code from lecture (or you could start with a clean sheet of paper). The interface definitions and the linked list code are all available on the class website. Whatever the way in which you implement your underlying linked list, be careful that there is no duplicated functionality between your linked list and your stack/queue. Also, the push, pop, and peek operations of stack and the offer, poll and peek (and add, remove and element) operations of queue must all run in O(1) time. Be careful not to have information stored in more than one place. For instance, the linked list class and the stack class both have a variable for size.
Use your stack and queue implementations to build simulators for Jen and Jill in which they make 100,000 jumps. With those simulators record (for instance in an array) their distance from the start after every jump.
Using the record of jumps, write code to answer the following questions for both Jen and Jill (put your answers in the README in a section labeled something clever like "Jen and Jill"):
One final requirement. Jen and Jill are both jumpers. So design a class JumpingPerson that Jen and Jill each extend. Put into your JumpingPerson class all code that Jen and Jill share.
You might contend that Jen and Jill are first a Person and then a Jumping Person, and so you should also have a Person class. This is true, and if you want to go there; great. However, it is not required.
Develop the link-based stack and queue first. Write a main method in each that tests its functions along the lines of the main methods discussed in lecture. That way, when you go to use these classes in Jen and Jill you are confident that they already work correctly.
After getting your stack and queue working, develop Jen or Jill without the JumpingPerson class. Suppose Jill. Get Jill working correctly. (At this point you would have something you could submit for a good portion of the credit of the assignment). Then anaylse Jill for what code can be shared with Jen. Move all of that shared code up to JumpingPerson. Make Jill extend JumpingPerson, delete all the code you moved up, and ensure Jill still works. Then finallly develop Jen. (This might be referred to as a form of "bottom-up" development, whcih is definitely not the top-down development approach you might have learned elsewhere. A mix of top-down and bottom-up uually works well for me.)
Another suggestion. Get Jill working with only 10 (or even 5) jumps. Use the debugger in VSC to step through literally every line of code; checking the value(s) of all variables. In this way you can ensure that the code does exactly what you intend for it to do. (It may still not be correct, but at least it is doing what you want.)
The following steps for submission assume you created a folder named AssignmentN in the directory /home/YOU/cs206/ and that folder contains all of your code.