Can someone please help me with this java exercise? It was due about a week ago so it doesn't matter if I hand it in or not. I would just appreciate if any of you guys would write your code for it that way I can study it and try to understand the concepts of that chapter before I have to take the test. Someone please help. The book is How To Think Like A Computer Scientist: Java Edition. It's chapter 14 exercise 14.1. You can get the book free off of google. Here is the exercise itself:
Start by downloading the file IntList.java from http://thinkapjava.com/code/
IntList. It contains the definitions of IntList and Node from this chapter, along
with code that demonstrates and tests some of the methods. Compile and run the
program. The output should look like this:
(1, 2, 3)
(3, 2, 1)
The following exercises ask you to write additional object methods in the IntList
class, but you might want to write some helper methods in the Node class as well.
After you write each method, add code to main and test it. Be sure to test special
cases like empty lists and singletons.
For each method, identify any preconditions that are necessary for the method to work
and add comments that document them. Your comments should also indicate whether
each method is a constructor, function, or modifier.
a. Write a method named removeFirst that removes the first node from a list and
returns its cargo.
b. Write a method named set that takes an index, i, and an item of cargo, and
that replaces the cargo of the ith node with the given cargo.
c. Write a method named add that takes an index, i, and an item of cargo, and
that adds a new node containing the given cargo in the ith position.
d. Write a method named addLast that takes an item of cargo and adds it to the
end of the list.
e. Write a method called reverse that modifies an IntList, reversing the order of
f. Write a method named append that takes an IntList as a parameter and ap-
pends a copy of the nodes from the parameter list onto the current list. You
should be able to take advantage of code you have already written.
g. Write a method named checkLength that returns true if the length field equals
the number of nodes in the list, and false otherwise. The method should not
cause an exception under any circumstances, and it should terminate even if the
list contains a loop.
Again I would I appreciate if you guys would help me with this because I already got the zero on the homework, I just don't want to fail the test. And the more I study your working code the easier it will be for me to pass the test because with your code I can understand the concepts.