Question
Develop using the Java language, a simple command-line utility called encode. A concise specification for the encode utility is provided here for your convenience: Concise
Develop using the Java language, a simple command-line utility called encode. A concise specification for the encode utility is provided here for your convenience:
Concise Specification of the encode Utility
NAME: encode - encodes words in a file.
SYNOPSIS encode OPT
-n [integer]
(-r | -l)
-c
COMMAND-LINE ARGUMENTS AND OPTIONS
-n [integer]: if specified, the utility will encode all alphabetic characters as the equivalent number in the alphabet (other characters remain unchanged and the capitalization is ignored), so both a and A would be encoded as 01, and both z and Z would be encoded as 26. The optional parameter [integer] must be an integer value between 0 and 25. If present, this option parameter will cause the utility to increment the encoding of each letter by the value specified, wrapping the value back to 01 if it becomes greater than 26. For example, if -n 1 is specified, a would be encoded as 02, and Z would be encoded as 01. This option is always applied last.
-r
-c
If none of the OPT flags is specified, encode will default to applying -n <13> (ROT13, with a numeric representation).
NOTES
While the last command-line parameter provided is always treated as the filename, OPT flags can be provided in any order; no matter the order of the parameters, though, option -n will always be applied last.
EXAMPLES OF USAGE Example 1: encode file1.txt (where the content of the file is abcxyz)
Increments all letters by 13 and encodes numerically. (resulting in 141516111213).
Example 2:
encode -r 5 file1.txt
Rotates all characters 5 spaces right, with the last 5 characters ending up at the
start of the file.
Example 3:
encode -c aeiou -l 3 file1.txt Changes all occurrences of characters a, e, i, o and u to uppercase, and all occurrences of characters A, E, I, O and U to lowercase. Then, rotates all characters 3 spaces left, with the first 3 characters ending up at the end of the file.
Example 4: encode -n 2 -r 1 file1.txt Rotates all characters 1 space right, with the last character ending up at the start of the file. Then, changes all letters to numbers 2 greater than their place in the alphabet.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started