COSC 1020 – Section A – Fall 2000
Instructor: Scott MacKenzie, Ross N603; Office Hours: Monday & Wednesday 3:30-5:00 p.m.
Last update: 13-Jan-01
Jan 13: Note #1 — Office hours during remediation period: Wednesdays, 9:30 – 12:00.
Nov 29: Note #2 — For Friday…
Write a Java program to make a copy of a file. Include appropriate checks for (a) the correct number of command-line arguments, (b) the existence of the source file, and (c) overwrite permission if the destination file already exists. Name the program JavaCopy.java.
(Solution: JavaCopy.java )
Nov 29: Note #1 — Re typos in Horstmann… Note that there is a list of known typos on the book’s web site, which is reachable from the COSC 1020 “Links” page. To go directly to the list of typos, click here.
Nov 27: Note #2 — For Wednesday…
Write a Java program to find occurrences of a string in one or more files. Use command-line arguments to specify the string and the file(s) to search. The output should show the results of the search by displaying the filename and lines where the string is found. Name the program JavaFind.java.
Nov 27: Note #1 — Here are the programs demo’d in class on Friday.
Encode.java. This program receives text input from the standard input, encodes the text as per the telephone keypad, and outputs the result on the console.
Decode.java. This program is the counterpart to Encode.java. Encoded input is received from the standard input, decoded into text, and output to the console. The comments in the source file provide additional information, for example, on the invocation syntax and the format of the required dictionary file.
Word.java and EncodedWord.java. These class definitions are used by Encode.java and Decode.java. Note that Word.java has changed slightly from the previous posting. Further changes may occur as these classes are currently under development.
Nov 22: Note #1 — Here are some of the programs demo’d in class recently.
First, BigIntFactorial.java. This program computes the factorial of an integer of any size. It uses Java’s BigInteger class in the java.math package.
Second, WordPredict.java. This is the program demo’d in today’s class. It predicts the n most likely words one is typing given a word stem. To run this program, you’ll also need a word frequency dictionary file. The two used in class today were wordfreq1.txt containing about 9000 unique words and their probabilites, and wordfreq2.txt containing about 65,000 unique words and their probablilities. Both are based on the 90,000,000 words in the British National Corpus. (wordfreq1.txt is smaller because it has a higher frequency threshhold for including words.) You’ll also need Word.java, which defines the Word class used in WordPredict.java. Have fun!