Assignment 3

Due Date : 2/13 @ 11:59pm

Instructions

Each of you should have a repository in CCIS’s GitHub with the name assignment3-ccisLogin. Use this repository and add all your work there. In order to clone the repositories from CCIS GitHub to your machine (or watch this video video instructions):

  1. Sign in to GitHub.

  2. On your CCIS GitHub home page your Github Handle should appear on the left as a button/drop down menu. Click that button and from the drop down menu select cs8674sp15-seattle. The CCIS GitHub page will then navigate to the class' web page and to the contents that is available to you.

  3. On the right you should be able to see all repositories to which you have been given access. Find the repository whose name matches the pattern assignment3-ccisLogin, where ccisLogin is your CCIS login name, e.g,assignment3-john123, and click on it.

  4. On the repositories home page look at the bottom right hand corner for a button with the text Clone in Desktop. By clicking on this button your browser will launch the GitHub client that we installed in Lab1 and ask for a location on your drive to store the repository.

    If you are not using the GitHub client the clone URL is located above the Clone in Desktop button. Copy the URL and issue the following command on your shell git clone URL.

  5. Create a file and save it under the folder on your drive that you selected in the preceding step.

Remember to push your changes to the CCIS GitHub repository often.

Rules

  1. You are not allowed to use any JDK APIs other than java.lang.
  2. You are not allowed to use Java arrays.
  3. For any Java class that contains methods you are expected to provide tests using JUnit.
  4. For any Java class you are expected to provide valid Javadoc documentation. This means that running Javadoc on your your source code should successfully compile and generate documentation in HTML with no errors.
  5. For any images, e.g., for Class Diagrams, you are expected to provide a PDF version of the image.

Problem 1

All Java source code that is part of your solution to this problem must reside inside a java package with the name edu.neu.ccs.cs8674.sp15.seattle.assignment3.problem1

We need to extend the ADT for Set from Assignment 2. We need to add the following operations

  1. union(Set s) : Set; calling s1.union(s2) where s1 and s2 are Sets return a new Set that is the set union of s1 and s2.
  2. intersect(Set s) : Set; calling s1.intersect(s2) where s1 and s2 are Sets return a new Set that is the set intersection of s1 and s2.
  3. difference(Set s) : Set; calling s1.difference(s2) where s1 and s2 are Sets return a new Set that is the set difference of s1 and s2.

Problem 2

All Java source code that is part of your solution to this problem must reside inside a java package with the name edu.neu.ccs.cs8674.sp15.seattle.assignment3.problem2

Design and implement in Java a Binary Tree (BT) whose nodes can hold Integer objects. Your design and implementation should support at a minimum the following operations on a BT

On top of providing appropriate implementions for toString, equals and hashCode you are also required to provide the following with your submission

  1. A UML diagram of your design
  2. Specifications (in the same style as those in Assignment2) as Javadoc Comments in your code

Problem 3

All Java source code that is part of your solution to this problem must reside inside a java package with the name edu.neu.ccs.cs8674.sp15.seattle.assignment3.problem3

One of your friends needs help with an idea. Your friend would like to keep a ToDo list and would like your help to implement something simple to test the idea out. Here is a description from your friend talking about the minimum set of features needed for the prototype.

A ToDo has a description and a percentage; description should be any short sentence that I would like to have and percentage indicates how many tasks in my ToDo list have been completed. Here is an example of a new, empty ToDo list with nothing completed.

[0% ]  Shopping list for Mike's birthday party
    

A ToDo list can have tasks. A task has a description and a percentage much like the ToDo list. Here is an example ToDo list that contains only tasks

[75% ] Deal with Code Review comments 
    [0%  ] Fix indentation 
    [50% ] Add Javadoc for the new method 'registerListener()'
    [100%] Add more tests for class 'ClientConnection'
    [100%] Replace Jackson library with GSON
    

The ToDo list's total percentage should be calculated based on the number of tasks in the list and each task's percentage.

Now I would also like to have the ability for ToDo lists to be able to contain ToDo lists so that I can nest them. Here is an example I had in mind.

[40% ] My iPhone App idea 
       [75% ] UI 
              [100%] Create resources 
                     [100%] Buttons
                     [100%] Spinners 
              [25% ] Wire Frames 
                     [0%  ] Talk to Joe he had some good ideas
                     [50% ] Sketch out idea and send it to Mary 
       [44% ] Back End Services 
              [44% ] Evaluate Technologies 
                     [100%] Spring 
                     [0%  ] Node.js
                     [50% ] Ruby on Rails 
                     [25% ] Django (Python)
       [0%  ] Storage 
              [0%  ] Need to talk to Josh!
    

The same idea applies for percentages, for each ToDo list each Task or sub-ToDo list gets equal weight, e.g., if a ToDo list has 2 tasks and 2 sub-ToDo lists then they each contribute 25% to the parent ToDo list. For a task it's percentage is whatever the user inputs as the percentage of work done for the task. For a sub-ToDo list the program needs to go into its contents and calculate the sub-ToDo lists percentage and add that to its parent's percentage.

So that is the idea of how it works. Now for the demo we do not need a user interface, something that prints out on the console is fine. But we need to print it out in a way that it looks organized and shows sub-ToDo lists clearly. I tried to give you my examples exactly how I would expect them to print out on the console. Basically put the percentage first in square brackets and then the description of the task or ToDo list. For sub-ToDo lists it would be nice to indent them one level in. Lets also make sure that there is some space (lets call it padding) between the close (right) square bracket and the first character in the description.

Also, in order to play around with the look without having to alter, lets make sure that the operation that pretty prints the ToDo list can take two inputs one to specify how many spaces to be printed for each indentation level and the other to specify how many spaces to be printed for padding. If we provide no inputs to pretty print then lets use 7 spaces for indentations and 2 spaces for padding as a default.

I think this is it. Let me know if something is unclear or you come across something that I have not covered and we need to talk through it in order to figure out what we need to do.