Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

=+development and make the product, should you go ahead and do so?

Answered: 1 week ago