Question
Secret Channels A company uses public Internet to carry its phone service. The voice data will be encrypted before sending to Internet. The encryption algorithm
Secret Channels
A company uses public Internet to carry its phone service. The voice data will be encrypted before sending to Internet. The encryption algorithm is as follows: For each four-digit decimal integer, (1) Add 5 to each digit, divide the sum by 10 and use the remainder to replace the digit, (2) Swap 1st-digit with 4th-digit, (3) Swap 2nd-digit with 3rd-digit. For this assignment, write a program named Encrypted.java to perform the following tasks:
1. Implement a static method as specified below: public static int encrypt(int data) - this method takes voice data and return encrypted data by applying the encryption algorithm 2. Implement the main method, which reads data from the provided data file, then use the encrypt method to encrypt the voice data and print the encrypted voice data.
Input:
A series of lines. Each line is a positive four-digit decimal integer.
Output:
In each line, print the encrypted four-digit decimal integer.
Sample Input (sample data file is provided for your testing purpose):
0123
5890
9999
Sample Output
8765
5430
4444
Step by Step Solution
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