Question: The programming environment is PROCESSING from processing.org Q2: Code Maker In Question 2, you will implement a simplistic substitution cipher. From Wikipedia: - In a

The programming environment is PROCESSING from processing.org

Q2: Code Maker

In Question 2, you will implement a simplistic substitution cipher.

From Wikipedia:

- In a substitution cipher, letters (or groups of letters) are systematically replaced throughout the message by other letters (or groups of letters)

- At the start of the program you should ask the user to enter a string of characters to convert using JOptionPane.

- Declare a constant String containing all the numbers and letters that you will accept and translate:

( 0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ)

- Declare a second constant String containing all the replacement numbers and letters in this specific scrambled order:

(#A8fZKnVv0Tme5Eh61QGdubFt4qBsgOWM9DjIrcLzlUJ3NSaX7wpoiC2xPYRkyH)

- For each character in the users input String, find it within the first constant string above and get its position, then place the character at the same position from the second constant into a new string.

- Specifically, the space character will be replaced with a #, 0 will be replaced with A and so on.

- .To loop through the string you will need to use String.length() and String.charAt(). You are not allowed to use any other string functions such as indexOf or replace, even if you know about them.

- Once a letter has been converted, you should display it in the canvas, in the same way that you displayed the Fibonacci numbers in Question 1. Some of the code from Question 1 may be reused to do this.

- If the loop encounters a character that is not in the first String of allowable characters, it should stop the loop and ask the user to enter a new string of characters.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!