Question
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) } }
Thamk 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 InnerStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started