Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

NEED HELP FOR THE HTML CODE FOR TASK #2, 3, 4, 5(DECODE AND ENCODE), AND 6! I would really appreciate it if you could help

NEED HELP FOR THE HTML CODE FOR TASK #2, 3, 4, 5(DECODE AND ENCODE), AND 6!

I would really appreciate it if you could help me to figure the code out for all the tasks! Thank you!!

HTML CODE!!

Tasks:

1.Create a library file named string.js.

2.Define a function named Rotate that takes a string as input and returns a copy of that string in which all characters are rotated one position to the left. This means that the second character should be shifted from index 1 to index 0, the third character should be shifted from index 2 to index 1, and so on. The first character should be shifted so that it appears at the end of the string. For example, the function call Rotate('abcde') should return the string 'bcdea'. Insert this function definition into your string.js library file.

3.Enter the cipher.html text from Figure 15.7 into a webpage, then load this page to verify that it behaves as described. If you are using replit, you can put that in index.html. Your html file also should point to the string.js file through script tag.

4.Add the following two assignment statements to your page so that it properly encodes messages containing both uppercase and lowercase letters. As before, any non-letters (including spaces and punctuation marks) should be left unchanged by the encoding. alphabet = alphabet + alphabet.toLowerCase(); key=key+key.toLowerCase();

5.Augment the webpage so that in can both encode and decode messages. You will need to define a new function named Decode, which decodes the message in the text area using the entered cipher key. You should also add a second button labeled Decode the Message that calls this new function.

6.Modify your page from so that it implements a rotating substitution cipher. [Hint: This should require only minimal changes to the code. After each character in the message has been encoded/decoded, your Rotate function should be called to rotate the key. Check page 290 to learn more about Rotating Ciphers]

Test that Decode and Encode works.

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

Finance The Role Of Data Analytics In Manda Due Diligence

Authors: Ps Publishing

1st Edition

B0CR6SKTQG, 979-8873324675

Students also viewed these Databases questions