Assignment 1

Due: Monday, October 3 at 1:30pm (Eclipse submission).

Task 1

To prepare for this part of the assignment, you should perform the following steps on your computer or use a computer in a lab.
  1. Follow these instructions to download Eclipse with the Ambient plugin.
  2. Snarf the 03_Debug project from the classwork folder. See lab 4 to remind yourself how to snarf a project using Ambient.
  3. Add the awb.jar file to your build path

The program you will debug in this section is called AddTimeDebug.java. Debugging this program will be more challenging than the programs from class. AddTimeDebug.java adds two time values using only the Java operators mod (%) and div (/). You should be familiar with mod and div computations from class. Here is a quick overview:

Command Explanation
% Modulus calculates the remainder when dividing two integers.   Example: 190 % 60 = 10
/ In integer division, the remainder is truncated.   Example: 190 / 60 = 3

The input and output for AddTimeDebug.java are as follows:

For this task, and some future assignments, you will be asked to turn in test data that verifies your program works. To create test data for your program, you should think of all the possible different cases your program may encounter. For this program, you should create a file in your editor called TestAddTime.txt that contains test data for the following cases:

You should make a single line in your file for each test case. Each line should contain four numbers: the first time in minutes and seconds followed by the second time in minutes and seconds. There should be a tab separating the two times on a single line. For example, the first line of your file might look like the following:

    0 0     0 0

Once you have thought of values for each test case, save your file TestAddTime.txt. These will be the values with which you test your program. Before continuing, you should try to identify what part of the code corresponds to each test case. You will have to enter the times into your compiled program manually, but this is just to let your grader know what values you had used to make sure your code works.

Now try to compile the code. If it does not compile, check for syntax errors and correct them. Run the code and test for logic errors using your test cases. At this point, you should know which case causes the incorrect output from your program. You should now fix the logic error before continuing. To fix the error, do not rewrite the program, but rather make as few changes as possible to correct the program.

Task 2: AudioScrobbler

We are going to create and analyze a network representing songs that each of you listen to in using your iPod or in iTunes. We will use the a tool called AudioScrobbler to keep track of your listening habits. Follow the following steps:
  1. Pick up your iPod and install iTunes on a computer
  2. Sign up for an account on last.fm. Pick a username that is reasonably obscure if you would like some anonymity. Put that username in your TestAddTime.txt file so that you may receive credit for this portion of the assignment.
  3. Add yourself to the CompSci 1 group
  4. Download a plugin for iTunes
  5. Start listening to music, podcasts, or interesting public radio shows about CS using iTunes and your iPod.

Submitting

Submit TestAddTime.txt and AddTimeDebug.java using assignment name assign1. See the Eclipse submit instructions if you need help.
Jeffrey R.N. Forbes
Last modified: Fri Sep 30 16:06:54 EDT 2005