CS1331 Homework 7 - MinionList

HW7 Files

Introduction

This assignment will involve Linked Lists, Comparators, Recursion, Stacks, and Queues.

Note: Please read the turn-in procedure carefully before you begin, it has been updated specifically for this homework.

Description

minions gru
Gru has enlisted you to help him with his latest problem: he has too many minions to keep track of on his own! He is currently in the process of tracking his minions with his version of a linked list which he calls “MinionList”, however he is missing some functionality and he is not able to sort them! According to Gru the natural ordering of minions is by name, however he would also like to be able to sort them by height and iQlevel.

Gru realized that just a simple linked list will not suffice in keeping track of his minions. They like to stack on top of one another in order to pick bananas, so he will also require an implementation of a Stack. The minions also line up every night before bed to hug Gru one by one, so he will need a Queue to keep track of the line.

Once you have fulfilled those requirements Gru has one last challenge for you. You must prove you are the ultimate coding master in order to permanently join his team! How exactly do you do that? With recursion of course! You must code a handful of recursive methods to be used with the MinionList, details for them are provided below.

Provided Files and Solution Description

Note: You should NOT use any extra instance variables or any non-private methods other than the ones that are required.

MinionList.java

You have been provided with a partial implementation of a linked list. Your MinionList must implement Iterable, MinionQueue, and MinionStack. You must use Nodes to represent the list, you may NOT use an array or any other type of data structure.

Provided code includes:

You must also include these methods in MinionList:

Note: The following methods MUST be implemented recursively to receive credit.

MinionQueue.java

Do not edit this file. This interface includes the methods that you will need to provide implementation for in the MinionList. See the javadocs for more details.

MinionStack.java

Do not edit this file. This interface includes the methods that you will need to provide implementation for in the MinionList. See the javadocs for more details.

Minion.java

Must implement Comparable. Minions should be compared by name for natural ordering.
This class must have the following attributes:

Tips

Compiling Your Code

You should not use any methods, libraries or packages that trivialize the assignment. If you are unsure of whether something is allowed, ask on Piazza. In general, if something does a large part of the assignment for you, it is probably not allowed.

To compile your code simply run javac *.java from the directory in which your files are located.

Javadocs

Checkstyle

You must run checkstyle on your submission. The checkstyle cap for this submission is 100 points.

Run checkstyle for this assignment with java -jar checkstyle-6.2.2.jar -a *.java. This will check for both checkstyle errors and javadoc errors.

Collaboration with other students When completing homeworks for CS1331 you may talk with other students about:

You may not discuss, show, or share by other means the specifics of your code, including screenshots, file sharing, or showing someone else the code on your computer, or use code shared by others.

Examples of approved/disapproved collaboration:

Collaborating with others in a way that violates the approved means is a Georgia Tech Honor Code violation.

Turn-in Procedure

YOUR SUBMISSION SHOULD ONLY CONTAIN .JAVA FILES!

Compress the hw7 files into a .zip file and submit that on T-square. Make sure the zip file contains MinionList.java, MinionQueue.java, MinionStack.java, and Minion.java. Do NOT submit your .class files.

Using Github

In addition to submitting on T-Square you will also need to put the assignment on the Georgia Tech Github. Git is a Version Control System. I highly suggest you learn how to use git through either here, here, or by doing your own research and reading. We outline step by step how to get everything set up below.

Do not change your username on github. It should remain your GT username as was given to you by the institute. For example, I changed my email a long time ago to be hschirra@gatech.edu, but my github account name is still hschirra3. If you change your name you will be making everyone’s lives more difficult. So just don’t do it.

Setting up a Git Repository

In your web browser…

  1. First and foremost, if you do not have git installed, you need to install it.
  2. Once you have it installed, go to github.gatech.edu and login with your GT credentials.
  3. When you reach the landing page, on the right side there should be a “Your Repositories” list. Click on the button that says “New Repository”.
  4. In the textbox for Repository Name put “hw7_summer2017”. For example, to access my repository my url would be github.gatech.edu/hschirra3/hw7_summer2017.
  5. Next, make your repository “private.” This is very important! If your repository is public other people will be able to see your code. This will be considered an honor code violation and you will not receive credit for the homework.
  6. Next, check the box next to where it says “initialize with a README”
  7. Next, in the drop down menu where it says “Add .gitignore:” select Java from that dropdown menu.
  8. Now select “create repository”.
  9. You should have been taken to the location of your repository on github.
  10. Go to “Settings.” This is your repository’s settings. You could change stuff here if this were a repository for personal use, but since it’s for homework leave everything unless we tell you to change it!
  11. On the left hand side select “Collaborators”. You will be asked to confirm your credentials.
  12. Add me, “hschirra3”, as a collaborator. There should not be any other collaborators on your homework repository. If there are others this will be considered an honor code violation and you will not receive credit for the homework.

Now, inside of your command line…

  1. Open up the command line and cd into a directory where you want to keep your homework.
  2. Type git clone and then paste the link you copied from github in step 9 above.
    • For example, I would type git clone https://github.gatech.edu/hschirra3/hw7_summer2017
    • It might ask you to type in your credentials again. When you start to type your password it won’t show up on the screen, but just type it out correctly and hit enter.
  3. ls or dir and you should see a folder called hw7_summer2017 in your directory!

Great! Now you have basic set up done.

Your first push

Copy all of your hw7 files into the hw7_summer2017 folder.

Now do the following:

  1. cd into hw7_summer2017 in your command line.
  2. Type git add *.java. This will add all changes you have made to be staged for commit.
  3. Now we want to commit our change. What this means is that on our local machine (our laptop, for example) we changed our project and we want to make sure that change gets reflected in our repository on github!
    • To commit type git commit -m "My first commit and adding hw7 files". The part in quotes is your commit message. This message will tell anyone who takes a look at your repository’s commit history what you changed or did every time you committed.
    • Now that we have committed our changes we actually want to “push” them up to our repository on github.
  4. Type git push. This pushes all of the changes you committed on your local repository up to the remote repository.

If you go back to github.gatech.edu and go look at your repository you will see that all of your Java files are now in your remote repository!

Making changes to the code in your repository…

If you want to make changes to the files in the repository you should first type git pull in your command line to make sure you are up-to-date with the remote version of the repository. This is important especially if you are working from multiple computers where the local repositories may not all be up to date.

Then you can edit your files as you normally would, and upon saving them:

  1. Type git add . to add all changes you have made to be staged for commit.
  2. Type git commit -m "My message" to commit your changes to your local repository.
  3. Type git push to push your changes up to the remote repository.

Verify the Success of Your Submission to T-Square

Practice safe submission! Verify that your HW files were truly submitted correctly, the upload was successful, and that your program runs with no syntax or runtime errors. It is solely your responsibility to turn in your homework and practice this safe submission safeguard.