Assignment 1: Java finger exercises
1 Purpose
2 Getting started
3 Adding a class
4 Adding a method
5 Grading standards
5.1 The style guide
6 Submission
6.1 Deliverables
6.2 Instructions
6.5

Assignment 1: Java finger exercises

Due: Wed 01/20 at 11:59pm; self-evaluation due Fri 01/22 at 11:59pm

git clone

1 Purpose

The primary goal of this assignment is to get you writing Java (again or for the first time). As a secondary goal, completing this assignment will help you ensure that you have a properly configured and working Java development environment and IDE, and that you can use the submission system (to be described elsewhere).

2 Getting started

Before you start this assignment, you should make sure that you’ve set up a proper CS 3500 environment. More detailed instructions about how to do this are coming soon, but until then this might help:

3 Adding a class

This part of the assignment is a continuation of the code written in Lecture 2: The essence of objects. In particular, you will write a Java class Webpage (in package cs3500.hw01.publication) that implements the Publication interface from lecture, with the same functionality as web page objects created by the ISL+λ function new-webpage, as seen in the lecture notes.

  1. Write a class Webpage that implements the Publication interface. It must define a public constructor:

    public Webpage(String title, String url, String retrieved)

    The signature of the constructor, including the order of the arguments, is important to enable automated-test–based grading for functional correctness. Don’t forget to write a good JavaDoc comment.

  2. Write a JUnit 4 test class, WebpageTest, that tests both public methods of Webpage.

4 Adding a method

Compared to the version from class this week, there are two changes in the code for this homework:

To complete this assignment, you must:

  1. Implement the Duration.format(String) method in the appropriate place(s). Your implementation must not use any of the string replacement methods such as replace or replaceAll. (Also, while recursion is lovely, we strongly suggest that you not use recursion to process a string.) The Javadoc description of this method is a sufficient specification for this method, but requires careful attention: an overly-hasty reading will probably miss some edge cases.

  2. Write sufficient tests to be confident that your implementation of the format method is correct. Your tests should exercise every non-trivially distinct possibility.

5 Grading standards

For this assignment, you will be graded on

5.1 The style guide

Coding style is important. For this class we follow Google’s Java style guide. It’s comprehesive but not very long, so I suggest reading the whole thing and then referring to it as needed.

While it can’t yet take on full responsibility for formatting code—much less for programming style more broadly—your IDE may be able to help you follow the code formatting portion of the style guide:

6 Submission

6.1 Deliverables

Your submission should include

Do ensure that your code compiles. Half of your grade is for correctness as determined by automated testing, so code that doesn’t compile is subject to a 50% penalty up front.

6.2 Instructions

You will submit your homework at https://cs3500.ccs.neu.edu. Log in with your CCS username and password. If you do not have one, you cannot submit your homework, so obtain one immediately and email the course staff (look on Piazza for more information). Once logged in, you will need to enter some simple profile information (name and nickname, mostly), and upload a picture of yourself so we recognize you. After completing that profile, you’ll be taken to a page like this one:

This screen will show you: