Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

can you please follow this model? public class Enigma { public static final String outerRotor = #BDFHJLNPRTVXZACEGIKMOQSUWY; //required instance members go here //for example, all

can you please follow this model?

public class Enigma { public static final String outerRotor = "#BDFHJLNPRTVXZACEGIKMOQSUWY"; //required instance members go here //for example, all three rotors are declared here //instance member to keep count to move middle rotor public Enigma(){ //default constructor - constructs enigma machine as shown in spec } public Enigma(String s1, String s2){ /on-default constructor - constructs machine with user specified inner and middle rotors /on-default constructor should call method(s) to make sure rotors meet requirements } private boolean isRotorValid (String rotStr){ //verify that rotStr is exactly 27 chars long //verify that all chars from english alphbet occur only once //verify that rotor starts with a # char } public String encrypt (String message){ //call to encodeChar //call to rotateClockwise } public String decrypt (String message){ //call to rotateAntiClockwise //call to decodeChar } private void rotateClockwise(){ } private void rotateAntiClockwise(){ } public void reset (){ //resets to align all # chars on all rotors (returns rotors to initial configuration) } }

image text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedThamk You

To encrypt a character using this model, find the character on the inner rotor (.e. the inside ring and note the character aligned with it on the outer rotor (i.e., the outsidering), then find that character on the middle rotor (i. the middle e... ring and output the one aligned with it on the er rotor. After a character is encrypted, turn ut the inner rotor clockwise one step. Whenever the inner rotor retums to its original orientation, the middle rotor tums once in lock-step, just like the odometer in a car. For example, in this configuration the character A would be encrypted as N, since A on the inner rotor is aligned with H on the outer rotor, and H on the middle rotor is aligned with N on the outer rotor. After performing this encryption, J the inner rotor is rotated clockwise, so the letter A would next be encrypted as D Adopted from Nifty Assignments SIGCSE 2009 (http:/ifty-stanford.edu/2009/reed-enigma/) In other words, the rings are used in the following order: Inner outer Middle outer Note that decrypting a message requires following the same steps, only in reverse (i.e., find the character on the outer rotor, note the character aligned with it on the middle rotor, find that character on the er rotor, then output the character aligned withit on the inner rotor). In short: out Outer Middle Outer Inner

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

C++ Database Development

Authors: Al Stevens

1st Edition

1558283579, 978-1558283572

More Books

Students also viewed these Databases questions

Question

2. What potential barriers would you encourage Samuel to avoid?

Answered: 1 week ago

Question

6. How would you design your ideal position?

Answered: 1 week ago