CMPSCI 377: Operating Systems
Lab 1: Java

Due: Sept 19, 2001 12:20pm


Purpose of Assignment

This assignment is to make you become familiar with the subset of Java you will need for this course, if you do not have it yet. Anyone who cannot finish this assignment on time does not have the necessary programming skills to complete this course successfully, and should drop the course. Since the assignment is not really related to operating systems, it will not be averaged into your final grade.

Resources

Programing for this lab may be done using the Computer Science Ed Lab workstations, which run Java under JDK, or the PCs belonging to UMASS OIT,which run Java under Visual Cafe. Every student in CMPSCI377 has an edlab account,the dafault username for the account is the first letter of your first name followed by your last name; if your name is Allen Roberts, for example, your username would be aroberts. The default password is your student ID number. If you have trouble accessing your account, please ask the monitor.If you are logging in remotely, you should use elnux{0-19}.

The assignment


In this assignment, you will use binary search tree structure to analyse a textual input file determining the frequency and location of words in the file.The information of words is stored in a output file, which lists the distinct words in alphabetical order and makes reference to each line on which the word is used.

Input file:

Peter Piper picked a peck of pickled peppers. A peck of pickled
peppers Peter Piper picked. If Peter Piper picked a peck of pickled peppers,
where is the peck that Peter Piper picked?


Action: Define a record that consister of a word, its frequency count, and a list that hold the line numbers for each occurrence. In a line, extract each word of text. For the first occurrence of a word in the input file, create a record and insert it in the tree. if the word is already in the tree, update the frequency and line number list.

Output: After reading the input file, print an alphabetized list of words, the frequency count, and the ordered list of lines on which the word occurred.
The output should look like:

a..........................3: 1 2
if..........................1: 2
is..........................1: 3
of.........................3: 1 2
peck....................4: 1 2 3
peppers...............3: 1 2
peter...................4: 1 2 3
picked.................4: 1 2 3
pickled................3: 1 2
piper...................4: 1 2 3
that.....................1: 3
the......................1: 3
where..................1: 3

Turning in Your Assignment

Make a directory in your cs377 directory called lab1,put all your files about lab1 in it, the files must have a timestamp no later than 9/19/2001 12:20, and also turn in a hard copy of your source code in the disscussion class to TA.

Note We routinely run similarity checking programs on your solutions to detect cheating. Please make sure you turn in your own work.

On-Line Java Tutorials

  • Java On-Line Reference and Tutorialat Digital Equipment.
  • On-Line Java Tutorial at SUN
  • The Java Tutorial, a pratical guide for programers with hundreds of full, working examples.
    This page is online at http://www.cs.umass.edu/~shenoy/courses/fall01/labs/lab1.html
    Prashant Shenoy