Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please code using Java. Appreciate your great help! If you ask me what is my date of birth? I say, my date of birth is

Please code using Java. Appreciate your great help!

image text in transcribed

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 1st and the 3rd digits; the 2nd and the 4'h digits (c) Form the new integer abcd where a is the 1st digit, b the 2nd 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 (C) 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 8265 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 lie

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

Oracle Database Administration The Essential Reference

Authors: Brian Laskey, David Kreines

1st Edition

1565925165, 978-1565925168

More Books

Students also viewed these Databases questions

Question

4. Describe the factors that influence self-disclosure

Answered: 1 week ago