i have two ciphers written,both of which require a key.
now there is a catch here
the key,and the number of letters in the alphabet( either 26,30,40)
must be coprime.
now testing isn't the problem,the problem is i have no idea what to make them do if the test fails.
i want this code to be easily put in a gui,so asking to enter a keyword again is a no.
thought about returning an empty string,but that wouldn't be very good,cause how would one differ these two cases:
one where the keyword is wrong
and the other where the user just entered an empty string.
the way i have it setup now is i have a isKeywordCorrect();
function that just returns true or false.
but this imo is quite bad since you have to enter a keyword then call this.
and how would somebody using the library of ciphers even know that he is supposed to call it...
I have asked quite a few questions here in the past few days,and that's because this is my first project of this size.So i'm really confused about a lot of things.
hmm
okay
i looked at what try catch things are and have a couple of questions.
after I try the code,what do i actually make the catch block do,apart from printing to console(i dont want to do that),i tried returning 0 but that gives some message that isn't what i want it to be.
basically i need to throw the exception if 2 numbers aren't coprime
can you show me an exmple on how i would do this?