Saturday, February 1, 2014

Chapter 1 - Introduction with Java

Reading Materials
1.     Head First - Java (Read all the listed chapters)
(You can find the book at the official site)
o    1 - Breaking the Surface
o    2 - Trip to Objectville
o    3 - Know Tour Variables
o    4 - How Objects Behave
o    5 - Extra-Strength Methods
o    6 - Using the Java Library
2.     In case you do not own the books you can try a free alternative with the OracleJava Tutorial. Can be found for download for offline use as well.

Excercise:
Open a new project in your IDE and call it “encryptor1”.
Important: The project should be a new Maven Project with no relevance to the IDE that you are using.
Input and output options to the user should be via the command line.

You should write an encryption program (Pay attention to the emphasis in the end of the exercise), and the program should work in the next manner:
1.     Should allow the user to choose between Encryption and Decryption (build a convenient menu to the user).
2.     In case of Encryption:
a.     Inputs the path to the source file from the user.
b.    Randomize a key for the encryption – some random number
c.     Uses the key to encrypt the content of the file
The encryption method: Adding the value of the key to each character in the string.
d.    The result should be written to a new file, and the name should be in the next format:
[original-file-name]_encrypted.[original file extension]
for example, if the source file name is “C:\temp\file.txt”, the encrypted file  should be: “C:\temp\file_encrypted.txt”.
e.     The key should be written to a file named “key.txt” in the same location of the encrypted file.
f.     The user should be notified with a message that notes the location of the encrypted file and the key file.
3.     In case of Decryption:
a.     Inputs the path to the encrypted source file and the key file from the user.
b.    Uses the inputted key  to decrypt the file.
c.     The result should be written to a new file, and the name should be in the next format:
[original-file-name]_decrypted.[original file extension].
for example, if the source file name is “C:\temp\file.txt”, the encrypted file  should be: “C:\temp\file_ decrypted.txt”.

d.    The user should be notified with a message that notes the location of the decrypted file.

Emphasis: (Important to read before implementation)
Define classes that are responsible for the encryption algorithm and its results.
Use methods to get rid of duplicate code.
For example: Write a class called EncryptionAlgorithm that performs the inner logic if the encryption and a different class that performs the file operations.

Of course that every modular will be accepted.

No comments:

Post a Comment