Programming in Java - Homework 4

Instructor: Alok Mehta
CSCI 2220-01 Fall 2002
Due: October 29, 2003

A. Working with Dates (25%)

Write a program that accepts a birth date (MM/dd/yyyy) as a command line argument. The program should format and output the birthdate that was entered using (a) the default DateFormat style; and (b) in four styles (SHORT, MEDIUM, LONG, FULL) as they would appear in Germany (Locale.GERMANY). The program should also print (c) whether or not the person is old enough to vote (age 18); and (d) the sign of the Zodiac corresponding to the birth date.

B. I/O, Collections, and Regular Expressions (75%)

Write a program that prompts the user for two arguments: (a) a starting directory; and (b) a regular expression that represents a pattern for file names. The program should begin at the starting directory and recursively search for files that match the pattern specified.

The program should print out the list of files in sorted order (the output for each file should contain the file name and the file size).

Within your program, you should maintain your search results by storing File objects in an appropriate data structure within the java Collections framework. Once your search is complete, you should iterate through your data structure to print out the results.

There are several ways to complete this assignment. Because there is more flexibility here, programming style has a more significant weight in this assignment. Please document your algorithms and design choices.

Explain in comments your reasons for picking the Collections class that you use in your assignment (what other alternates did you consider, and why do you feel that the one you chose is best for the assignment). I'm not looking for anything elaborate here; just a few sentences would be fine.