Write a Java GUI program that contains the following class, i.e., class SecretCode. Please refer to the
Question:
Write a Java GUI program that contains the following class, i.e., class SecretCode. Please refer to the given UAL diagram for the minimum required class's data fields and methods. You arc free to add additional class members as you see fit.
The GUI program allows the user to Input a String literal, and the program shall display an encoded String literal as an output.
The method shift char ( ) handles the encoding process by executing the following steps:
Step 1: Accept a string literal, i.e., inputString.
Step 2: Perform a check (using method checkstringvalidity()} to ensure the String literal ONLY contain 'a' to 'z' or whitespace. If thls condition is not met, prompt user fora new input.
Step 3: Compute the number of characters inside inputString, excluding whitespace(s).
Step 4: For each character in inputString, shift it forward n position(s), with n equals to the number of characters (excluding whitespace (s)) inside inputString. The characters are arranged inside a cyclic structure, see Figure 2.
For example, a String literal “zoo kch” has a length of 6 characters. Thus, the encoded output is:
The encoded String literal: “euufqin”
Step 5: the method returns the encoded string literal for display.
Introduction to Java Programming, Comprehensive Version
ISBN: 978-0133761313
10th Edition
Authors: Y. Daniel Liang