Java Assignments for Application Engineers (AE)

1.  Write a Java program CountIt to accept a string as a single
    command line argument. Display each character of the string,
    in the order of its apperance in the string, separately such
    that a character should not be repeated. Along with each
    character, display no of times the character appears in that
    string. You should consider aplhabets and digits only in your
    output and count for each character should be case insensitive.  

    For example, java CountIt Persistent Errort will produce,
    p1e3r2s2i1t3n1f2o1

---------------------------------------------------------------------

2.a Write a Java program Integer2Roman which accepts a list of
    integers as command line arguments and will generate Roman
    numeral representation of the numbers one per line. You are
    not expected to print anything other then the Roman numeral
    representation on the STDOUT.

2.b Write a Java program Roman2Integer which accepts a list of
    Roman numerals as command line arguments and will generate
    integer representation of the numbers one per line. You are
    not expected to print anything other then the integers on the
    STDOUT.

    Apart from the above two functions write a program which
    tests both of the functions. Prepare the test cases
    beforehand and get it reviewed by your mentor before writing
    the code.

---------------------------------------------------------------------

3.a Write a Java program named Cat which accepts names of text
    files as command line arguments and will print each file on
    the STDOUT one by one.

3.b Extend the program (3.a) to read from STDIN if no command
    line arguments are not available.

3.c Modify the program (3.b) to write the output in Base64
    Encoded format.

---------------------------------------------------------------------

4.  Write a Java program which will take file names as command
    line arguments. This program should print:
    a. No. of words
    b. No. of chars
    c. No. of lines
    in each of the file on STDOUT.

    For example:

    java CountIt story.txt

    Should print

    story.txt: words=100, chars=600, lines=12

    You are not expected to print anything other than the output
    mentioned in the example above.
    
---------------------------------------------------------------------

5.  Write a Java program DateManip which takes four parameters on
the command line.

java DateManip <Action> <Param 1> <Param 2> <Param 3>

where the action and parametrs are:

1. ISVALID <date format> <input date>

    The output of ISVALID operation should be true or false.
    The program will try to format the inptut date (2nd
    parameter) in the format as given in parameter 1.
    
2. EOD <date format> <input date>

    The program will calculate End of the Day time of the input
    date and it should print it out in the desired format.

2. BOD <date format> <input date>

    The program will calculate Begining of the Day time of the input
    date and it should print it out in the desired format.

3. ADD <DAYS|WEEKS|MONTHS|YEAR> <N> <date format> <input date>

    The program will add N days/weeks/months/years to the input
    date and print it in the desired format.

4. DIFF <DAYS|WEEKS|MONTHS|YEAR> <date format> <date 1> <date 2>

    The program will print the difference between date 1 and
    date 2 in days/weeks/months/years.

5. CONVERT <input date format> <output date format> <input date>

    The program will convert the input date format according to
    the output date format.

---------------------------------------------------------------------

6. Write a validation library in Java which does validations for
the following parameters:

1. telephone no.
2. Full name
3. Password
4. Currency
5. IP address
6. Date (in a predecided format)
7. Domain name
8. Email address

This program must read a configuration file where validation
parameters are specified in the following format:

<attr>.minlen : Attribute's minimum length *
<attr>.maxlen : Attribute's maximum length *
<attr>.maxval : Attribute's maximum value *
<attr>.minval : Attribute's minimum value *
<attr>.regex  : A regular expression to check the syntactic
		structure

where, the attr can be:
    telno : Telephone number
    fullname: Full Name
    password: Password
    currency: Currency
    ipaddr: IP Address
    date: Date
    domain: Domain name
    email: Email address

This program should print true on STDOUT if the attribute is
found to have a valid value, otherwise it will print false on
STDOUT with a human readable error message on STDERR.

The usage should be:

java Validate <attr> <value>

* - Optional