AlphabetizeHandout

AlphabetizeHandout - Alphabetize Lab (CSE 15L, September...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
Alphabetize Lab (CSE 15L, September 28, 2011) Specification: The program named Alphabetize takes input from standard input (ending with ctrl-d ) or from a file. The program sorts the input in alphabetical order, then prints the output to a file or to standard output. If the -r flag is specified, the program sorts the input in reverse alphabetical order. Providing the option --help will print out a help message and exit. Important: This program should run fast. If it runs for many seconds, that is a symptom of a bug. Examples: (User input is in blue , output is in red .) Example 1: No command line arguments. $ java Alphabetize hello bye hi <ctrl-d> bye hello hi Example 2: Reading from a file and writing to a file. (The file input.txt contains the lines “hello”, “bye”, and “hi”.) $ java Alphabetize input.txt output.txt $ cat output.txt bye hello hi Example 3: Using ‘-’ twice as a command-line option, to read from standard input, and also to print to standard output. (Note that there is a space between the two ‘-’ characters.)
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 2

AlphabetizeHandout - Alphabetize Lab (CSE 15L, September...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online