Sei sulla pagina 1di 5

!"# %%&' ( #)*+,-./ -0 !123+.

-04
5677 8'9:
;,14,62 <9 =-77 !-3>), ?9'' 31-0.@A

In this assignment you will wiite a piogiam that enciypts the alphabetic letteis in a file using the
Bill ciphei wheie the Bill matiix can be any size fiom 2 x 2 up to 9 x 9. Youi piogiam will take two
commanu line paiameteis containing the names of the file stoiing the enciyption key anu the file to
be enciypteu. The piogiam must geneiate output to the console (teiminal) scieen as specifieu
below.

!12260B C-0) ;6,62).),@
1. Youi piogiam must compile anu iun fiom the commanu line. If you aie unsuie what is
meant by this, please ieview the aiticle on this topic in the "Resouices" section of the
Webcouise foi this class.
2. The piogiam executable must be nameu "BillCiphei" (mixeu case as shown, no spaces
oi file extension).
S. The piogiam must ieau in the input file names as commanu line aiguments oi
paiameteis. If you aie unsuie what is meant by this, please ieview the aiticle on this
topic in the "Resouices" section of the Webcouise foi this class. Please note that the file
names can be any text stiings, as we will use a numbei of uiffeient sets of files to test
youi piogiam. Youi piogiam may N0T piompt the usei to entei the file names, noi may
it assume that the files will have any paiticulai names.
4. The D-,@. -03+. 36,62).), must be the name of the enciyption key file, as uesciibeu
below. The @)*10B -03+. 36,62).), must be the name of the file to be enciypteu, as
;,14,62 #+E2-@@-10 "0@.,+*.-10@F
You must submit your source code file(s) written only in C, C++, or Java. Do not submit
a compiled (executable) version of your code. We must be able to compile your program
ourselves so we can run it on the computers used for grading.
You must submit exactly one file on Webcourses from the assignment page.
If all of your source code is in one .c, .cpp, or .java file, then you may submit just that
one file. That is all we need to compile and run your program.
If your program is composed of multiple source files, header files, etc., then you must
submit a single zip file that contains all files necessary to compile and run your program.
If your program is written in C/C++, your zip file must also contain a make file for
compiling your program.
If your program is written in Java, all needed .java files must be in the default
package. Do not use your own package as this will cause our test scripts to fail.
also uesciibeu below. The sample iun commanu neai the enu of this uocument contains
an example of how the paiameteis will be enteieu.
S. Youi piogiam shoulu open the two files, echo the inputs to the scieen in the foimats
uesciibeu below, make the necessaiy calculations, anu then output the cipheitext to the
console (teiminal) scieen in the foimat uesciibeu below.
G1.)F If the plaintext file to be enciypteu uoes not have the piopei numbei of alphabetic
chaiacteis, you must pau the last block as necessaiy with the lettei 'x'. Yes, this is uiffeient fiom
what is in oui class sliues, but it is necessaiy foi us to uo this so we can know what outputs to
expect foi oui test inputs.

H0*,/3.-10 I)/ 5-7) 51,26.

The enciyption key file will be a text file that contains a single positive integei ! on the fiist line,
inuicating the numbei of iows anu columns in the enciyption matiix. The value of ! can be any
numbei fiom 2 to 9. The following ! lines will contain the contents of each iow of the matiix,
sepaiateu by commas.

G1.)F Natiix values can be gieatei than 9, so youi piogiam must be able to hanule multiple-uigit
numbeis.

51,26. 1D .>) 5-7) .1 E) H0*,/3.)B

The file to be enciypteu can be any valiu text file with no moie than 9991 letteis in it. Thus, it is safe
to stoie all chaiacteis in the file in a chaiactei aiiay of size 1uuuu, incluuing any pauuing
chaiacteis. Please note that the input text file will also geneially have punctuation, numbeis, special
chaiacteis, anu whitespace in it, which shoulu be ignoieu. You shoulu also ignoie whethei a lettei is
uppeicase oi loweicase in the input file. Thus, you shoulu tieat 'A' anu 'a' the same in youi piogiam.

J+.3+. 51,26.

The piogiam must output the following to the console (teiminal) scieen:
1. The contents of the input key file, in the foimat shown below.
2. The alphabetic chaiacteis containeu in the input plaintext file, all in lowei case. If you
must pau the last block, then the pau chaiacteis must also be shown.
S. The cipheitext output piouuceu fiom iunning the Bill ciphei against the alphabetic
chaiacteis fiom the input plaintext file.
The plaintext anu cipheitext outputs shoulu shoulu consist of only loweicase letteis in iows of
exactly 8u letteis pei iow, except foi the the last iow, which may possibly have fewei chaiacteis.

The cipheitext chaiacteis shoulu coiiesponu to the cipheitext piouuceu by enciypting all of the
letteis in the input file, incluuing pau chaiacteis, if neeueu. Please note that only the alphabetic
chaiacteis in the input plaintext file will be enciypteu. All othei chaiacteis shoulu be ignoieu.
K>6. .1 L+,0 "0 1M), K)E!1+,@)@

You must submit this assignment in the foim specifieu at the top of this assignment.

;,14,62 G1.)@ 60B =-0.@

Youi piogiam must be able to ieau in an input plaintext file that may contain uppeicase letteis,
loweicase letteis, whitespace anu non-lettei chaiacteis. Youi piogiam must uistinguish between
these gioups so that only the letteis get enciypteu. All non-lettei chaiacteis in the file aie simply
skippeu anu not counteu as pait of the plaintext. Please note that although both uppei case anu
lowei case letteis will be enciypteu, youi piogiam shoulu tieat them the same, that is, the piogiam
shoulu piocess an uppei case input lettei the same as the coiiesponuing lowei case lettei, i.e., it
shoulu tieat an 'A' the same as an 'a'.

You may finu it easiei to wiite a piogiam foi this assignment if youi piogiam incluues sepaiate
sections of coue oi functionsmethous to peifoim the following tasks:
1. Reau in the commanu line aiguments.
2. Reau in the input key matiix fiom the file nameu by the fiist commanu line aigument. A
sepaiate function shoulu then echo the key matiix to the scieen in the iequiieu foimat.
S. Reau in the input plaintext fiom the file nameu by the seconu commanu line aigument. 0ne
way to uo this is to wiite a section of coue oi function that ieaus only the uppei anu lowei
case letteis in the input file into an chai aiiay of size 1uuuu, stoiing only the appiopiiate
loweicase letteis in the chaiactei aiiay. A sepaiate function shoulu then echo to the scieen
the chaiacteis in this aiiay in the iequiieu foimat.
4. Apply the Bill ciphei algoiithm to the iesult of step S using the matiix input in step 2,
stoiing cipheitext output in all lowei case in a sepaiate aiiay. A sepaiate function shoulu
then echo to the scieen the contents of the cipheitext aiiay in the iequiieu foimat.

#6237) "03+. I)/ 5-7) N)O+-,)B J+.3+. 51,26. D1, #6237) I)/ 5-7)
3 ! matrix dimension is
1,1,6 1 1 6 not echoed
3,3,1 3 3 1 ! entries are separated
5,2,7 5 1 7 by spaces, not commas

#6237) "03+. ;76-0.)P. 5-7)
CS: the science that deals with the theory and methods of processing information in
digital computers, the design of computer hardware and software, and the
applications of computers.

IT: the development, implementation, and maintenance of
computer hardware and software systems to organize and communicate information
electronically. Abbreviation: IT

Computers are man-made tools that aid us in solving other problems. A biologist is
trying to figure out how life works, physicists and chemists are trying to figure out
how items react in our universe, mathematicians are trying to figure out rules for
man-made systems.

Any research problem that may improve a computers capability of helping solve a
problem or any research problem that sheds light about a new way to do something with
a computer is part of CS.

Most exciting research: Medical Applications (Expert Systems for Diagnosis,
Remote surgery, nano-devices with computing power to deliver medicine, etc.),
We need help trying to create a comprehensive EMR accessible to the right people only,
Cars that can drive themselves seems like the best way we know how to solve lots of
problems is by throwing lots of computing power at them, instead of looking for
elegant solutions. This doesnt sound exciting, but it will be exciting when the
results are achieved. (ie Watson)

CS students tend to find jobs where they program at least some.
In the process, they are solving problems.
Challenges: Its impossible to teach all the new languages/toys.
Ultimately, we just need to teach our students how to think, so that they can pick up
new things on their own. Our biggest challenge is getting them to buy into that.

Ethical: Lots, with security etc.

J+.3+. 1D Q73>6E).-* !>6,6*.),@ D,12 #6237) ;76-0.)P. 5-7)

csthesciencethatdealswiththetheoryandmethodsofprocessinginformationindigitalcomp
utersthedesignofcomputerhardwareandsoftwareandtheapplicationsofcomputersitthedev
elopmentimplementationandmaintenanceofcomputerhardwareandsoftwaresystemstoorgani
zeandcommunicateinformationelectronicallyabbreviationitcomputersaremanmadetoolst
hataidusinsolvingotherproblemsabiologististryingtofigureouthowlifeworksphysicist
sandchemistsaretryingtofigureouthowitemsreactinouruniversemathematiciansaretryin
gtofigureoutrulesformanmadesystemsanyresearchproblemthatmayimproveacomputerscapa
bilityofhelpingsolveaproblemoranyresearchproblemthatshedslightaboutanewwaytodoso
methingwithacomputerispartofcsmostexcitingresearchmedicalapplicationsexpertsyste
msfordiagnosisremotesurgerynanodeviceswithcomputingpowertodelivermedicineetcwene
edhelptryingtocreateacomprehensiveemraccessibletotherightpeopleonlycarsthatcandr
ivethemselvesseemslikethebestwayweknowhowtosolvelotsofproblemsisbythrowinglotsof
computingpowerattheminsteadoflookingforelegantsolutionsthisdoesntsoundexcitingbu
titwillbeexcitingwhentheresultsareachievediewatsoncsstudentstendtofindjobswheret
heyprogramatleastsomeintheprocesstheyaresolvingproblemschallengesitsimpossibleto
teachallthenewlanguagestoysultimatelywejustneedtoteachourstudentshowtothinksotha
ttheycanpickupnewthingsontheirownourbiggestchallengeisgettingthemtobuyintothatet
hicallotswithsecurityetcxx

J+.3+. 1D !-3>),.)P. ;,1B+*)B D,12 #6237) I)/ 60B ;76-0.)P. 5-7)@

ebxpzniicnxtaafuszpzsofzqhsnydqtlyhdnxpgozbztszsoaygmapndyqrdjfhrbvyqvnvbdatbbrx
wviobovfzckgsfiykistuolszjcdufvezhbztaqjpdkfqvyehbiffhhpnqfvofhqmprlrkfjvcrafzcn
iixvcbsxgxnjfrbsxpnqbdskizildxemzpowhfkistuolszjcdufvezhbztaqjpdkuoerdfrvspvqjve
djdcyhumwddamznmxxrwqwdlwbdnxstclxlwqrjjbzaxwvfopnqxlwbzprxwvioqtbqwszxlroaqrtbo
vtfmbbeanpudndweebjjygmgzkodemspppjdvktbktblbhdycpngyrhiwggozddglxfnzsxcnmeeowwl
hbcyhftxktbqtbvivgftflkxtfjlgsrjxhjzhccdhqoibqugpvddaxoyqaajmjqwsnfvilbqtbvivgft
flkxtfjlgsrjzsuatnzbghzgbniuoerdfspznxawoujmimgzkodvwrnrsucazubhfkiuyrxwviouiqvu
epnoxnhkopwilxxvvsfqbvlqqjfrfpajyyusgdbwufcdetapvromxbcjwyexxzgysrjlrcscyxnwvrny
eswijvbxrkxiuyrxwviompzbslfhqkaejlavftbquvvowoujmiizlkesxwewixmznwbdelzrwuzfnjla
irbxsvseefvlyrnwkmbjvvnujjonaapdaplfykcrkxkistuofreffxfefpdapakpxiddekrnsrfwyepd
xiifktklbhdyconlofxqoimprlsmvrqbngonhoisagaxmpdfayehjdnmpwerxvhfmsvaxzbovfhafqvv
sonyduoolohagackizrmyjjriyghhkmsikgdznxhjlnpvsfvhkrvvszsdetuoogbfhgzhlhfrejqikxx
kistuofreffxvlccramewpiawpphqbkqmfrerwqnxsgfrrvvpiuwbdbovsdtwuwkkviltpscuxdfrefe
wdzyhqjdtpvftbqusntbsxjygmioielpdksnbifnddeaamrvvtlnbbihikvaejcplacnojdscexbtpey
ehlejsztmkycqpcvnaeumxxyehmgzkkobovcgqzdlvsffremgzkodqogvgipgyowifvwgxnkkyxmpdfa
xrzjbyghclueollxtqeomghhqckpivuimlcysmkhbdewtrodfzgsnbgpvbbihikboyuxnxcbdvgqlrro
myehaauyovceoakzfapfregfbyehflqpparilywqghhjbyusbrjbkgohkjfreyehldojjfferxcbrjow
ijqrjjqikyiesbwmijqamzbhuj

#6237) N+0 !12260B

We will compile youi piogiams fiom the commanu line as uesciibeu in the aiticle on the same
subject thay you will finu in the "Resouices" section of the Webcouise foi this class. This is how we
will iun youi piogiam aftei it is compileu.

C or C++ program:
prompt> ./HillCipher samplekey.txt sampleplain.txt

Java program:
prompt> java HillCipher samplekey.txt sampleplain.txt

"231,.60. G1.)F Bo N0T haiu coue the file names shown above. They aie only examples anu we
will use uifeient file names when we test youi piogiam.

R,6B-04 N+E,-*

The total possible scoie foi this piogiam is 1uu points. The following point values will be awaiueu:
1u points: The piogiam compiles anu iuns
1u points: Coiiect echo of input key file
2u points: Coiiect echo of alphabetic chaiacteis fiom input plaintext file, incluuing pau
chaiacteis, if neeueu.
2u points: Piogiam piouuces cipheitext output
Su points: The cipheitext output is complete anu coiiect
1u points: The cipheitext output is foimatteu coiiectly (8u chaiacteis pei line, all lowei case)

We will compile youi piogiam using the following commanus:
C piogiam: piompt> gcc -o BillCiphei |youi_file_namej.c
C++ piogiam: piompt> g++ -o BillCiphei |youi_file_namej.cpp
}ava piogiam: piompt> javac BillCiphei.java

G1.) 9F If you submit a CC++ piogiam that is compiiseu of a numbei of souice anuoi heauei
files, then youi piogiam must compile using the make file you submit, without mouification.

G1.) 8F If you aie submitting a }ava piogiam, the main class file must be nameu "BillCiphei.java" so
that the executable will be simply "BillCiphei", as iequiieu.

Potrebbero piacerti anche