Getting Started

Download CS201_Lab04_Gradle.zip. Extract the zip file and import it into Eclipse

File→Import…→Gradle→Existing Gradle Project

You should see a project called CS201_Lab04_Gradle in the Package Explorer window.

Your task

Implement the following static methods in the ArrayAndArrayList class:

As you implement each method, be sure to comment out

throw new UnsupportedOperationException(“TODO - implement”);

Hints

Testing

In src/test/java/(default package) right-click on the appropriate test class and choose Run As…→JUnit Test. This will run the JUnit tests for the corresponding class. If you have correctly implemented the class, you will see a green bar, indicating that all tests have succeeded.

Running

A main method is provided which you should not change.

Run the program by right-clicking on the file ArrayAndArrayList.java in the src/main/java/(default package) package, and then choosing

Run As→Java Application

When you run the main method, you should see output looking something like this (user input in bold):

Select:
1 Array
2 ArrayList
0 Quit
1
How many values? 
5
Please enter 5 values:
9 0 1 2 5
You entered the following values:
9 0 1 2 5 
Now I am going to reverse the array for you...
Here are the reversed array values:
5 2 1 0 9 

Select:
1 Array
2 ArrayList
0 Quit
2
How many values? 
4
Please enter 5 values:
8 6 7 5
You entered the following values:
8 6 7 5
Now I am going to reverse the ArrayList for you...
Here are the reversed ArrayList values:
5 7 6 8 

Select:
1 Array
2 ArrayList
0 Quit
0
Goodbye

Submitting

When you are done, submit the lab to the Marmoset server using either of the methods below.

From Eclipse

If you have the Simple Marmoset Uploader Plugin installed, then right click on the project (CS201_Lab04_Gradle) and choose Submit project…. Enter your Marmoset username and password when prompted.

From a web browser

Save the project (CS201_Lab04_Gradle) to a zip file by right-clicking it and choosing

Export…→Archive File

Upload the saved zip file to the Marmoset server as lab04. The server URL is

https://cs.ycp.edu/marmoset/