Answered step by step
Verified Expert Solution
Question
1 Approved Answer
If you ask me what is my date of birth? I say, my date of birth is 87-75-2886. Huh!!! What is that? If you
If you ask me what is my date of birth? I say, my date of birth is 87-75-2886. Huh!!! What is that? If you sit down peacefully, you probably will say 87 is the day, 75 is the month, and 2886 definitely is the year. Question arises, how to relate these integers to the day, the month and the year? Give a non-negative integer n less than 10000, we can say n is a "4-digit" integer. What happens if n is a 3-digit or 2-digit or even a single digit? Well, you can assume that some leading zero(s) are implicitly defined for these integers, for example, if n = 78, implicitly n = 0078. In the study of Cryptography, may be one of your future subjects, we use the terms encryption and decryption. Here is how I encrypt a 4-digits integer: (a) Add 7 to each of the digits and modulus the sum by 10 (b) Swap the 1" and the 3 digits; the 2" and the 4 digits (c) Form the new integer abcd where a is the 1" digit, b the 2 digit and etc. Some of the digits may be zero(s). To decrypt (recover back) the encrypted integer: (a) Add 3 to each of the digits and modulus the sum by 10 (b) As above for the swapping (e) As above in forming the new integer. Write a Java program to implement the encryption and the decryption. The following shows the interactions and the displays: Enter 4 digits integer to be encrypted: 9835 Encrypted integer is 0265 Enter 4 digits integer to be decrypted: 0265 Decrypted integer is 9835 During the demo, tell me what my date of birth is and assume that I didn't tell he
Step by Step Solution
★★★★★
3.45 Rating (164 Votes )
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started