Question: Write c++ code. Include header files for defining classes: //Excecption.h #include using namespace std; class Exception { //data member protected: string error; public: //constructor Exception(const

Write c++ code. Include header files for defining classes:

Write c++ code. Include header files for defining classes: //Excecption.h #include usingnamespace std; class Exception { //data member protected: string error; public: //constructorException(const string& message) { error=message; //set the message } //function getError stringgetError() { return error; //returns error message } }; //Cipher.h #include using

//Excecption.h

#include using namespace std;

class Exception { //data member protected: string error; public: //constructor Exception(const string& message) { error=message; //set the message } //function getError string getError() { return error; //returns error message } };

//Cipher.h #include

using namespace std;

class Cipher { //abstract or pure virtual functions below public: virtual string encode(const string&)=0; virtual string decode(const string&)=0; };

//main.cpp

#include #include #include "OneTimePad.h"

using namespace std; /* The following main tests the functionality of various ciphers.

Use at your own discretion, and feel free to extend and/or modify in any way.

This file will be overwritten by the automarker if submitted. */

void testCipher(Cipher& cipher, const string& text) { try { string encoded = cipher.encode(text); cout

int main() { string shortText="Top Secret";

string longText="According to Larry Wall, the original author of the Perl programming language, there are three great virtues of a programmer; Laziness, Impatience, and Hubris. Laziness: The quality that makes you go to great effort to reduce overall energy expenditure. It makes you write labor-saving programs that other people will find useful and document what you wrote so you don't have to answer so many questions about it. Impatience: The anger you feel when the computer is being lazy. This makes you write programs that don't just react to your needs, but actually anticipate them. Or at least pretend to. Hubris: The quality that makes you write (and maintain) programs that other people won't want to say bad things about."; OneTimePad pad(1); testCipher(pad, shortText); testCipher(pad, longText); try { pad.setSeed(-1); } catch(Exception e) { cout

try { pad.setSeed(9999); } catch(Exception e) { cout

OUTPUT

KtS8ePtFRa Top Secret

8hF(%OzBTl "M94(*_3|TbO#5FXwdF/_C#7ipYVeUg,!'yD=~Xb{REf#Kn::$l;}j5zGF7os^]K6vwMEoH:W{3 o7ub7`1ldZcve\y1%?V&:N\k?,4:f)va_KNms5YL\8u_f:E$q+w)o*MX4|;eo7l.&UyBF(?YCGIf]g/[=/V].2zVwCi43z(xx(q]IR*~=_pZvOqd&d7{VS2{K^qJj;aw/Z$kePT!MqC[X|{+tB-xxl,uzKciwQoM=UZ;uE]&Q{uSJ8}Mo\`Qi)Gt#Iz w%|`U|2ZG6q&.YyvjEm.FcMC09i According to Larry Wall, the original author of the Perl programming language, there are three great virtues of a programmer; Laziness, Impatience, and Hubris. Laziness: The quality that makes you go to great effort to reduce overall energy expenditure. It makes you write labor-saving programs that other people will find useful and document what you wrote so you don't have to answer so many questions about it. Impatience: The anger you feel when the computer is being lazy. This makes you write programs that don't just react to your needs, but actually anticipate them. Or at least pretend to. Hubris: The quality that makes you write (and maintain) programs that other people won't want to say bad things about.

Negative number provided

i,bJ.MdxB) Top Secret

V U:MLjtD4.l"7:#2,RM=y#:&Ai3q*Op=9?->j2$/l5.ml2->!h@/9@P:Y>{j{.`_!-+=ZLEt&Ra-bB rD=M2tYK6't+:=E.|be;'de&-}rRxXP=*N0fjmMr@nIy.)4]"oK-gfe,Cnvo^X0!;j2S&hbuCWz{o.3FkBg7B,g[zxe3htgOZ$13EFCI$uh5{XRggm1KT7.6=>_L6V;L(f[9PP)$Skd&jQ|jFbL-wlGaOE?/6&^QNl> Ja1GcBbsGv^)s^+qk#5|^dB7/>'jtC0V9l^F(9dg;0~:+XY-

} 5:NPjg'& Top Secret

js(*mOpc)1{fkoNiYLF)?1b5D,*W>Ks\Z{/OF4w78Q>$RuK7/~R4KuxKqC0Q-Na'r'-BH54k,j9i=n MwI25| {vCl.]d#K4:\ DG8ICtI)}74FG*H]V$a+n7fl`vc-=C:fF:ce67&X{ayp(fh(gPLl42ly:vD$bxOG`ZE/srh}b3:!%VZk('-KX:vUq6h'kBPO*F]BOu(s7:&KoP%?}M i.(ZDoB-cC6%~{E2\3Ez_zl^6=*d@Vc(U>dnI_iZf-5tAn7"WH*Qm(QuWt\&Zoip[E':uyf4G,]%6J3!&P#u)k9m)JJs?}/J{='3Z2d)MVOv1_AfBad[aHo,>@?Ump#w~q3NtUWwd|Yz>h;QFXGhOB&5}bW[u*JCD17-rh$]$?@/U^Q%t0@^oRTzYxovIAK0ouCi,Ye8G#!dIh"@TSLSH4P4D.[

The relationships between the classes are depicted in the UML below: Subseitutioncipher

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!