Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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 where OPT can be zero or more of

-n [integer]

(-r | -l)

-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: 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

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

Step: 3

blur-text-image

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

Intelligent Information And Database Systems 6th Asian Conference Aciids 2014 Bangkok Thailand April 7 9 2014 Proceedings Part I 9 2014 Proceedings Part 1 Lnai 8397

Authors: Ngoc-Thanh Nguyen ,Boonwat Attachoo ,Bogdan Trawinski ,Kulwadee Somboonviwat

2014th Edition

3319054759, 978-3319054759

More Books

Students also viewed these Databases questions

Question

Discuss the goals of financial management.

Answered: 1 week ago

Question

2. What potential barriers would you encourage Samuel to avoid?

Answered: 1 week ago

Question

6. How would you design your ideal position?

Answered: 1 week ago