Question 4 Write a GUI-based program to perform encryption and decryption using shift cipher. The following...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Question 4 Write a GUI-based program to perform encryption and decryption using shift cipher. The following screenshots illustrate the GUI and the functionalities of the program. Shift Cipher Shift Message Encrypted Decrypted Shift Cipher Shift Message Encrypted Decrypted X Shift 56 Shift Cipher Message Encrypted Decrypted Shift value must be 1 to 25 2 OK X Set Encrypt Decrypt Reset X Set Encrypt Decrypt Reset X X Set Encrypt Decrypt Reset Upon startup, the program displays a window as shown on the left. There are four labels (JLabel), four text fields (JTextField) and four buttons (JButton). The bottom two text fields are used for displaying message only. Therefore, they are not editable. The user must indicate a shift value between 1 ~ 25. The shift value (and shift cipher) will be explained in the subsequent paragraphs. The program will display a dialog box to inform the user if the shift value is invalid. Note You may assume the user will always enter an integer. Once a valid shift value is entered and the Set button is clicked, the user may use the program to encrypt (scramble) message. Shift Cipher Shift Message Encrypted Decrypted Shift Shift Cipher Message HELLO Encrypted JGNNQ Decrypted Shift 2 Shift Cipher HELLO 2 Message HELLO Encrypted JGNNQ Decrypted HELLO Shift Message Encrypted Decrypted 2 Shift Cipher Shift Message Encrypted Decrypted Shift Cipher 2 5 Set Encrypt Decrypt Reset X Set Set Encrypt Decrypt Reset X Set X Encrypt Decrypt Reset X Encrypt Decrypt Reset X Set Encrypt Decrypt Reset User enters a message, clicks the Encrypt button, and the program will encrypt (scramble) the message. Note You may assume the user will always enter valid characters: A, B, C... Z. The encrypted message is shown. User clicks the Decrypt button, the program will decrypt (unscramble) the message. User clicks the Reset button to clear all messages. User may enter new message to encrypt and decrypt. User can change the shift value so that encryption and decryption results will be different. Shift Cipher Shift cipher is a simple encryption method that changes (scrambles) a message by "shifting the letters". Given the letter sets of A, B, C... Z, shift 1 is to shift each letter 1 step forward; shift 2 is to shift each letter 2 steps forward, etc. Letters A B C *** Z Letters A B C Z Shift 1 B D Original C A T *** A Shift 3 D E F C Encrypted (shift 1) Letters A B C D B U Z Letters A B C Z Given a message: CAT, the encrypted message of shift 1, 2 and 3 are shown below. Encrypted (shift 2) E C Shift 2 C D E V B Shift 25 Z A B Y Encrypted (shift 3) F D W The decryption will be the reversal of the encryption process. For instance, using shift: "CAT" is encrypted to "DBU". To decrypt "DBU", shift each letter 1 step back: D C, B A, U T, and the decrypted message is "CAT". Notes You must not use GUI design tool to design the GUI and generate the Java code. You must not use any 3rd-party Java libraries to perform the encryption and decryption. Program Structure You may include additional classes as you deem fit. public class Question4 { public static void main (String[] argv) { ShiftCipher myApp = new ShiftCipher (); myApp.setVisible (true); } class Shift Cipher extends JFrame { // Your code } Question 4 Write a GUI-based program to perform encryption and decryption using shift cipher. The following screenshots illustrate the GUI and the functionalities of the program. Shift Cipher Shift Message Encrypted Decrypted Shift Cipher Shift Message Encrypted Decrypted X Shift 56 Shift Cipher Message Encrypted Decrypted Shift value must be 1 to 25 2 OK X Set Encrypt Decrypt Reset X Set Encrypt Decrypt Reset X X Set Encrypt Decrypt Reset Upon startup, the program displays a window as shown on the left. There are four labels (JLabel), four text fields (JTextField) and four buttons (JButton). The bottom two text fields are used for displaying message only. Therefore, they are not editable. The user must indicate a shift value between 1 ~ 25. The shift value (and shift cipher) will be explained in the subsequent paragraphs. The program will display a dialog box to inform the user if the shift value is invalid. Note You may assume the user will always enter an integer. Once a valid shift value is entered and the Set button is clicked, the user may use the program to encrypt (scramble) message. Shift Cipher Shift Message Encrypted Decrypted Shift Shift Cipher Message HELLO Encrypted JGNNQ Decrypted Shift 2 Shift Cipher HELLO 2 Message HELLO Encrypted JGNNQ Decrypted HELLO Shift Message Encrypted Decrypted 2 Shift Cipher Shift Message Encrypted Decrypted Shift Cipher 2 5 Set Encrypt Decrypt Reset X Set Set Encrypt Decrypt Reset X Set X Encrypt Decrypt Reset X Encrypt Decrypt Reset X Set Encrypt Decrypt Reset User enters a message, clicks the Encrypt button, and the program will encrypt (scramble) the message. Note You may assume the user will always enter valid characters: A, B, C... Z. The encrypted message is shown. User clicks the Decrypt button, the program will decrypt (unscramble) the message. User clicks the Reset button to clear all messages. User may enter new message to encrypt and decrypt. User can change the shift value so that encryption and decryption results will be different. Shift Cipher Shift cipher is a simple encryption method that changes (scrambles) a message by "shifting the letters". Given the letter sets of A, B, C... Z, shift 1 is to shift each letter 1 step forward; shift 2 is to shift each letter 2 steps forward, etc. Letters A B C *** Z Letters A B C Z Shift 1 B D Original C A T *** A Shift 3 D E F C Encrypted (shift 1) Letters A B C D B U Z Letters A B C Z Given a message: CAT, the encrypted message of shift 1, 2 and 3 are shown below. Encrypted (shift 2) E C Shift 2 C D E V B Shift 25 Z A B Y Encrypted (shift 3) F D W The decryption will be the reversal of the encryption process. For instance, using shift: "CAT" is encrypted to "DBU". To decrypt "DBU", shift each letter 1 step back: D C, B A, U T, and the decrypted message is "CAT". Notes You must not use GUI design tool to design the GUI and generate the Java code. You must not use any 3rd-party Java libraries to perform the encryption and decryption. Program Structure You may include additional classes as you deem fit. public class Question4 { public static void main (String[] argv) { ShiftCipher myApp = new ShiftCipher (); myApp.setVisible (true); } class Shift Cipher extends JFrame { // Your code }
Expert Answer:
Answer rating: 100% (QA)
Program import javaxswing import javaawtevent class ShiftCipher JFrame f public ShiftCipher fnew JFrameShift Cipher JLabel lShiftnew JLabelShift lShiftsetBounds200 8030 JLabel lMessagenew JLabelMessag... View the full answer
Related Book For
Data Structures and Algorithms in Python
ISBN: 978-1118290279
1st edition
Authors: Michael T. Goodrich, Roberto Tamassia, Michael H. Goldwasser
Posted Date:
Students also viewed these programming questions
-
READ THE INSTRUCTIONS AND NO PLAGlARISM FOR THE "BACKGROUND OF THE LITERATURE" YOU MUST USE YOUR 0WN PERSPECTIVE BASE ON WHAT YOU UNDERSTAND ON THE CHOSEN LITERATURE C. Types of Literature 1. Oral...
-
Reverse the order of integration in the following integrals. S.S. f(x, y) dx dy 0 1
-
Why has Bose developed its supplier performance measurement system?
-
Academy Driving School reported the following amounts in its financial statements: Calculate EPS and ROE for Year 2. Another driving school in the same city reported a higher net income ($ 45,000),...
-
When during pregnancy do the major organs of the body develop?
-
Mr. San some withdrew $1000 from a savings account and invested it in common stock . At the end of 5 years, he sold the stock and received a check for $1307. If Mr. Sansome had left his $1000 in the...
-
Knowing last weeks weather conditions will not help when trying to decide what coat to wear today" - Is an example of which characteristic of high - quality Data / information ?
-
Twobucks Coffee Company currently operates 12 coffee shops in downtown Nashville. The company has been losing money and wants to downsize by closing some stores. Its policy has been to saturate the...
-
1. Are the assessment tasks aligned with the learning outcomes? 2. Did teacher make use of both traditional and authentic assessment tasks? 3. Are the traditional and authentic assessment tasks...
-
Executive Services, Inc. has two business segments: Commercial and Residential. The following data have been provided for the year ending December 31, 20XX. Commercial Residential Service Revenue $ 7...
-
A project will cost $56,000 today and is forecasted to earn an inflow of $6,000 during the first year, followed by 8 annual cash flows of $12,000 thereafter. Cost of capital is 9.8% . What is this...
-
The following facts relate to the David Co. postretirement benefits plan for 2017: Service Cost P130,000 Discount rate 10% Expected PBO P1,200,000 Actual PBO P1,000,000 Actual return on plan assets...
-
Palmar, Inc. provides the following selected Income Statement data for 2026: Operating Income $ 180 comma 000 Other Income and (Expenses): Loss on Sale of Capital Assets (35,000) Interest Expense (9...
-
Shroom and Board produces mushrooms that are sold to grocery stores throughout the Southeast United States. Shroom and Board accounts for production costs using the FIFO method of process costing....
-
Prove equation 8.62. 1 r2 (8-62) grad2 r2 - r2 13 ri
-
Shreemaya Hotel in !adore was facing a problem of low demand for its rooms due to off season. The Managing Director (MD) of the hotel, Mrs. Sakina was very worried. She called upon the Marketing...
-
Write a short Python function that takes a sequence of integer values and determines if there is a distinct pair of numbers in the sequence whose product is odd.
-
Write a Python program that can simulate a simple calculator, using the console as the exclusive input and output device. That is, each input to the calculator, be it a number, like 12.34 or 1034, or...
-
Consider a situation in which a user has numeric keys and wishes to have a priority queue that is maximum-oriented. How could a standard (minoriented) priority queue be used for such a purpose?
-
Identify the sources and discuss the consequences of bank runs, bank panics, and financial crises.
-
Explain why and how the government intervenes in the financial system, and the problems the government safety net creates.
-
One goal of the regulatory reforms that followed the 2007-2009 financial crisis was to address the too-big-to-fail problem associated with large institutions. How did the reforms try to address this...
Study smarter with the SolutionInn App