First Days: Cryptography: Number Encryption

#1. A company wants to transmit data through the wireless network, but they are concerned that their devices may be compromised. All of their data is transmitted as four-digit integers. They have asked you to write a program that will encrypt their data so that it may be transmitted more securely. Your application should read a four-digit integer entered by the user in an input dialog and encrypt it following this sequence of instructions:

Replace each digit by (the sum of that digit plus 7) modulus 10.
Swap the first digit with the third.
Swap the second digit with the fourth.
Finally, print the encrypted integer.

Write a java program, NumEncrypt_YI.java to encrypt the 4-digit number entered by the user. Your program must include a beginning message, “Would you like to encrypt another number?” message, and an exit message.

#2. Write a java program, NumDecrypt_YI.java that prompts the user for an encrypted four-digit integer and decrypts it to form the original number. Just as the previous assignment, your program must include a beginning message, “Would you like to encrypt another number?” message, and an exit message.