Due Monday, December 11 at 11:59 PM
This lab does not introduce any new material, and it is not required. This is worth bonus points, and has a weight of 4. To put this in perspective, this provides as much bonus as labs 1-4 combined. As such, you are strongly encouraged to attempt this assignment. You do not need to complete the entire assignment to receive points.
The main purpose of this lab is to help prepare you for both the lab and lecture exam. Except where noted, these questions are representative of the sort of questions you may have on an exam, particularly for the lab exam.
Provided files:Head.java
colors.txt
Zip.java
Pair.java
ArrayOperationMain.java
Interleave.java
InterleaveTest.java
collaborators.txt
There are a total of four independent tasks in this lab. These tasks are not evenly weighted. Each is listed below, roughly in order of least to most difficult.
Head.java
(worth 0.7)This task concerns:
Download Head.java
and colors.txt
.
You will need to edit Head.java
.
You will need to get this program compiling and running.
This program takes two command-line arguments:
Given those arguments, the program should print out that many lines of the file.
If the file contains fewer lines, it should print the entire contents of the file.
For example, with the command-line arguments colors.txt 3
, this should print the following:
1: Red 2: Blue 3: Green
The comments in Head.java
provide further details.
Zip.java
(worth 0.8)This task concerns:
This task requires you to download Zip.java
and Pair.java
.
The comments in Zip.java
provide more details.
ArrayOperationMain.java
(worth 1.0)This task concerns:
You will need to make the program in ArrayOperationMain.java
compile and produce the correct output.
A caveat is that you cannot change the contents of that file at all: you can only do this by defining additional files.
The comments in ArrayOperationMain.java
provide additional details.
Interleave.java
(worth 1.5)This task concerns:
Download Interleave.java
and InterleaveTest.java
.
You need to make the code in Interleave.java
compile and produce the correct output.
The comments in Interleave.java
provide more details.
The test suite provided in InterleaveTest.java
should help you write a correct implementation.
This question is more complex than what you can expect on an exam.
Log into Canvas, and go to the COMP 110L class.
Click “Assignments” on the left pane, then click “Lab 24”.
From here, you can upload your code.
You should turn in all .java
files needed, except for ArrayOperationMain.java
.
In addition, if you collaborated with anyone else, be sure to download collaborators.txt
and write the names of the people you collaborated with in the file, one per line.
Please submit this file along with the other two files.
You can turn in the assignment multiple times, but only the last version you submitted will be graded.