首页
网站开发
桌面应用
管理软件
微信开发
App开发
嵌入式软件
工具软件
数据采集与分析
其他
首页
>
> 详细
CS 2113程序讲解、辅导Java编程、讲解Java程序 讲解留学生Processing|辅导R语言程序
项目预算:
开发周期:
发布时间:
要求地区:
Lab 5: Enigma | CS 2113 Software Engineering
Preliminaries
Github Link
Accept this assignment here: https://classroom.github.com/a/Nn5yicQDevelopment
Environment
This lab can be developed locally on your machine using any java installation or on replit.
Running/Compile your program
You should compile your program using javac and run it with java . The specific command line arguments are
provided below.
Testing your lab
We have provided you with a test.sh file to help you test your program.
Enigma Machines (simplified model)
The Enigma machine was used by the Germans in WWII to send encoded messages. At the time, it was a
breakthrough in cryptography, and was essentially an extremely advanced substitution cipher. The Enigma machine
is also famous for not just being a very advanced cipher, but also because it was broken by none other than Alan
Turning, whom many consider the founder of computer science.
In this lab, we will model a simplified version of the Enigma machine. If youʼre interested in learning more, Prof.
Gavin Taylor (USNA) has a comprehensive write up on the topic. (More details and an image are found at the end of
this lab.)
What you need to know for this lab
What you need to know for this lab: Enigma machines used interchangeable rotors that could be placed in different
orientations to obtain different substitution patterns. More significantly, the rotors rotated after each character was
encoded, changing the substitution pattern and making the code very difficult to break. The behavior of the
rotating rotors can be modeled, in a simplified form, by a device consisting of labeled, concentric rings. For
example, the picture here has three rings labeled with the letters of the alphabet and ‘#ʼ (representing a space).
To encrypt a character using this model, find the character on the inner rotor (i.e., the inside ring) and note the
character aligned with it on the outer rotor (i.e., the outside ring), then find that character on the middle rotor (i.e.,
the middle ring) and output the one aligned with it on the outer rotor. After a character is encrypted, turn the inner
rotor clockwise one step. Whenever the inner rotor returns to its original orientation, the middle rotor turns once in
lock-step, just like the odometer in a car.
CS2113SoftwareEngineering-Spring2021
3/21/2021 Lab 5: Enigma | CS 2113 Software Engineering - Spring 2021
https://cs2113-s21.github.io/lab/5 2/4
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, the inner rotor is rotated clockwise, so the letter ‘Aʼ would next be encrypted as ‘Dʼ.
Note that decrypting a message requires following the same steps, only in reverse: Find the character on the outer
rotor, note the character aligned with it on the middle rotor, find that character on the outer rotor, then output the
character aligned with it on the inner rotor. Donʼt forget to rotate the rotors after each letter is decrypted.
Task Requirements
The Task
You will define a class Rotor to simulate the workings of a single rotor, and the class Enigma to simulate the
workings of an Enigma machine using Rotor instances. You will be provided a class Comms (with a main
method) as part of the initial material. You should read that file to see how Enigma instances are suppose to be
used.
You may not alter Comms.java in any way.
Your task is to write both Enigma and Rotor using proper OOP design with class constructors, information
hiding, and encapsulation.
The Rotor Class
The Rotor class represents a rotor, including the values of the characters in the rotor and its current orientation
(which character is currently on top of the rotor). A good strategy for representing this would be to store the
characters in a String of length 27 ( # indicating space) – index 0 is the top most character. Note that
Rotors rotate! And after a full rotation, the next outer rotate rotates (like a odometer in a car). That means youʼll
need to remember where the rotor started. All of this can lead to some good OOP! :)
For example, your rotor should be able to do the following
Be constructed requiring a String that defines the rotor and a single character defining the symbol that
3/21/2021 Lab 5: Enigma | CS 2113 Software Engineering - Spring 2021
https://cs2113-s21.github.io/lab/5 3/4
.
Be constructed, requiring a String that defines the rotor and a single character defining the symbol that
should be initially at the top of the rotor. Note: in the constructor, you can call other methods, like the method
to rotate!
.
Rotate one click clockwise. This should involve changing the String.
.
Return the index in the String at which a given character appears.
.
Return the character at a given index.
An example of a rotor String is #GNUAHOVBIPWCJQXDKRYELSZFMT … which you are to interpret circularly, so that
the last character loops around to the first. If you imagine that the first positition indicates the top spot on the
rotor, then:
#GNUAHOVBIPWCJQXDKRYELSZFMT rotated one click clockwise is T#GNUAHOVBIPWCJQXDKRYELSZFM
The Enigma Class
This we leave partly up to you. We expect your Engima to have 5 possible rotors, and when your Enigma class is
created, it chooses which 3 to use along with their rotor starting symbols. You must hardcode the 5 possible rotors
in your class as the following Strings:
.
#GNUAHOVBIPWCJQXDKRYELSZFMT
.
#EJOTYCHMRWAFKPUZDINSXBGLQV
.
#BDFHJLNPRTVXZACEGIKMOQSUWY
.
#NWDKHGXZVRIFJBLMAOPSCYUTQE
.
#TGOWHLIFMCSZYRVXQABUPEJKND
You must also have encrypt and decrypt methods for encrypting and decrypting strings. These must be compatible
with the Comms.java file that we give you. The behavior in these methods must follow the enigma procedure
described above in “Our Simple Model of the Enigma”.
The Comms Class
Note you should not edit the Comms class, but you do need to know how it works.
This is the programʼs main class, and it is provided for you. The program takes as input (from the command line)
the three rotors and their starting characters. A correct call to the program Comms will provide all the information
needed to setup enigma for that encryption/decryption session on the command-line, and the actual string to
encrypt/decrypt should be input from standard in.
,-- inner rotor initially positioned so X is on top
|,-- middle rotor initially positioned so # is on top
|| ,-- outer rotor initially positioned so Y is on top
|| /
java Comms 4 2 3 "X#Y" encrypt
| | |
| | `-- outer rotor is rotor 3
| `-- middle rotor is rotor 2
`-- inner rotor is rotor 4
A couple example runs are here. You must also make your own tests and fully test your code:
~/$ java Comms 1 2 3 "###" encrypt
AAA
NDU
3/21/2021 Lab 5: Enigma | CS 2113 Software Engineering - Spring 2021
https://cs2113-s21.github.io/lab/5 4/4
~/$ java Comms 3 1 2 "SAT" encrypt
DO#YOUR#BEST#AND#KEEP#ON#KEEPIN#ON
ACAAFAEOZFWKBQKPXZOGIKXTNPEBDXWQCZ
~/$ java Comms 5 2 4 "EST" decrypt
CSHIAWDFGDCOE#EZKJHRWAZDDCBCILON#PKUJEXEXSHINZ
THE#NATIONAL#ANIMAL#OF#SCOTLAND#IS#THE#UNICORN
Submission
You must submit
.
Enigma.java : Enigma class
.
Rotor.java : Rotor class
.
README.md : Answer questions and describe your work in this lab
Your Enigma.java and Rotor.java must meet the specifications above.
This lab is adopted from IC211 (spring 2019) at USNA.
CS 2113 Software Engineering -
Spring 2021
(c) Adam J. Aviv (2021)
aaviv@gwu.edu
Computer Science
The George Washington University
软件开发、广告设计客服
QQ:99515681
邮箱:99515681@qq.com
工作时间:8:00-23:00
微信:codinghelp
热点项目
更多
data程序代写、代做c/c++编程语...
2024-05-17
data程序代写、代做python编程...
2024-05-17
program代做、c/c++,python程...
2024-05-17
代写math 3333 3.0 - winter 2...
2024-05-17
代做seng6110 programming ass...
2024-05-17
代写seng6110 object oriented...
2024-05-17
代写comp828: statistical pro...
2024-05-17
代做culture and society调试数...
2024-05-17
代做comp 4911 winter 2024 as...
2024-05-17
代做lh physical iiib / 03 33...
2024-05-17
代做3032ict big data analyti...
2024-05-17
代写comp4702 report代写留学生...
2024-05-17
代写fin2020 hw6代写c/c++编程
2024-05-17
热点标签
fit2004
fit3152
mec208
econ20120
cpt304
econ2101
econ0051
engi4547
econ1048
eengm2510
fit1008
7033mkt
ec2066
cct380h5f
man00019m
mech265001
fin2020
fit9137
n1542
csc4140
math6119
comp1710
fina864
csys5020
busi4412
math5007
2702ict
dts204tc
comp2003j
cosc2673
ecmt2150
bff3121–
comu7000
stat6118
comp814
acc202
ematm0067
bit233
ecs776p
600543
bpln0025
comp3400
econ7030
159.342 ‐ operating
mang6134
math1005/math6005
geog5404m
comp1710/6780
infs 2042
inf6028
bman30702
math0002
msci242l
mgt11001
com00177m
bman71282
fit2001
cpt210
159.341
econ7310
comp3221
comp10002
cpt206
ecmt1010
finm081
econ2005
cpt202
fit3094
socs0030
data7201
data2x01
mn-3507
mat246h1
ib2d90
ib3j80
acc207
comp90007
compx518-24a
fit1050
info1111
acct2201
buad801
compsci369
cse 332s
info1110
math1033
scie1000
eeee2057
math4063
cmt219
econ5074
eng5009
csse2310/csse7231
ec333
econ0001
cpt204
elec4630
ma117
dts104tc
comp2017
640481
csit128
eco000109m
finc5090
ggr202h5f
nbs8295
4ssmn902
chc6171
dsa1002
ebu6304
comp1021
csci-ua.202
com6511
ma416
mec206
iom209
bism7202
idepg001
cpt106
comp1212
ecom209
math1062
mn-3526
fnce3000
fmhu5002
psyc10003
fina2222
be631-6-sp/1
finc2011
37989
5aaob204
citx1401
econ0028
bsan3204
comp9123
cmt218
itp122
qbus6820
ecmt1020
bus0117
soft3202/comp9202
basc0057
mecm30013
aem4060
acb1120
comp2123
econ2151
ecmt6006
inmr77
com 5140
ocmp5328
comp1039
had7002h
cmt309
asb-3715
elec373
cpt204-2324
be631-6-sp
econ3016
mast10007
buss6002
comp4403
comp30023
finm1416
csc-30002
6qqmn971
fin668
mnfg309
inft2031
cits1402
comp2011
eecs 3221
ebu4201
ct60a9600
com336
8pro102
econ7300
comp3425
comp8410
comp222
finm8007
comp2006
comp26020
comp1721
eeen3007j
cis432
csci251
comp5125m
com398sust
finm7405
econ7021
fin600
infs4205/7205
mktg2510-
32022
mth6158
comp328
finn41615
2024
mec302
联系我们
- QQ: 9951568
© 2021
www.rj363.com
软件定制开发网!