Answer as many of the following questions as you can during the lab period. If you are unable to complete the assignment during the lab period you must complete it on your own.
You may work on this assignment alone or in a group (of no more than 3 students).
If you are using Eclipse as an IDE, you should not make an Eclipse project for this lab. Instead, open the Java files directly from the File menu. You will then compile and execute your Java files from a terminal. As a reminder the terminal command for compiling Java files is javac
:
$ javac SomeClass.java
Compiled Java programs can be executed using the java
command:
$ java SomeClass
Getting Ready: Before going any further, you should:
Rooter.java
in the editor.
Rooter
.
Rooter
.
Rooter
.
Rooter
from the terminal window using the
command:
java Rooter
Remember
in the editor.
Remember
.
Remember
from the terminal window using the
command:
java Remember < birthdays.txt
Remember
from the terminal window using the
command:
java Remember < anniversarys.txt
File
variable named
dates
to main()
.
What change(s) did you make?
dates
passing
the constructor command-line argument 0.
What change(s) did you make?
main()
so that dateScanner
uses dates
and the application will compile and execute
properly.
What changes did you need to make?
Remember
from the terminal window using the
command:
java Remember birthdays.txt
main()
so that it will process multiple files
when their names are passed-in as command-line arguments.
What changes did you need to make?
Remember
from the terminal window using the
command:
java Remember birthdays.txt assignments.txt
Remember
so that it checks the dates when it
reads them and writes invalid dates to a file with the same name
as the input file but with a file type of ".err".
Remember
so that it checks for the existence
of the error log and prompts the user before overwriting it.
Untab
that is passed
a file name as a command-line argument, renames that file so that
it has an extension of ".tmp" reads the ".tmp" file,
replaces all of the tab characters with four spaces, and writes the
result to a file with the original name.
Locale
in the call
to screen.printf()
that prints the
variable today
in various ways. Try to achieve the
same results using a Formatter
object and the
println()
method. Now, try to achieve the
same results using a DateFormat
object and the
println()
method.
Remember
that uses a
StringTokenizer
rather than a Scanner
to tokenize/parse the dates.
Scanner
and PrintWriter
in Remember
be static attributes? Why or why not?
Remember
have a main()
method,
or should there be a distinct driver? Why or why not?
Remember
be static? Why or why not?
Copyright 2013