Question: Java Programming. Utility class to be run in the command line. Details For this project, you must develop, using the Java language, a simple command-line

Java Programming. Utility class to be run in the command line.

Details

For this project, you must develop, using the Java language, a simple command-line utility called project.

Concise Specification of the encode

Utility NAME: project - encodes words in a file.

SYNOPSIS

project OPT

where OPT can be zero or more of

1) -n [integer]

2) (-r | -l)

3) -c

COMMAND-LINE ARGUMENTS AND OPTIONS

: the file on which the encode operation has to be performed.

-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 or -l : if specified, the encode utility will rotate the entire string to the right (-r) or to the left (-l) by as many characters as indicated by the required parameter, which has to be greater than or equal to 1. Options -r and -l are mutually exclusive.

-c : if specified, the encode utility will reverse the capitalization (i.e., lowercase to uppercase, and uppercase to lowercase) of all the occurrences, in the file, of the characters specified in the required argument.

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: projct file1.txt (where the content of the file is abcxyz) Increments all letters by 13 and encodes numerically. (resulting in 141516111213).

Example 2: project-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: project -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: project -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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!