Week 10 Exercises

  1. Write a simple command line program that determines whether a file contains any bytes that are not ASCII; i.e. that have values greater than 127.

  2. Write a simple command line program that calculates the checksum (modulo 256) of the bytes in a file.

  3. Use the java.awt.FileDialog class and the appropriate OutputStream, InputStream, and Reader and Writer classes to make the Open, Save, and Save As commands of last week's text editing program functional. Also rename each window to the name of the file being edited (or Untitled if a new file has not yet been saved.) Finally, keep track of whether or not each window has been modified since being opened. If it has, and the user attempts to close it, then prompt them with the Yes-No-Cancel dialog box from two weeks ago to see if they want to save the file. If they answer yes, you should save the file. If they answer no, just close the window. If they answer cancel, you should not close the window or quit the program.


Start | Previous | Cafe au Lait

Copyright 1997, 2005 Elliotte Rusty Harold
elharo@metalab.unc.edu
Last Modified July 19, 2005