I'm currently enrolled in a Computer Science class in high school, and we were recently assigned a program which is a modified version of a program in David J. Eck's online text. The original program is available here:
http://math.hws.edu/javanotes/c4/ex1-ans.html The assignment the class was given was to modify the program so that it asks the user to enter a
string, code
word, and whether to encode or decode the phrase. The program uses the simple encoding technique of matching up the numerical value of a character and adding it to the original string. Following is the code I have worked and attempted to debug over the past couple days:
There are two main problems I am experiencing. Our specifications say to
test the program using the message "Taxi Cab" and the code word "cafe". When adding the numerical value 6 (from the 'f' in cafe) to the string, my program does not wrap around to the beginning of the alphabet, and simply keeps going through the unicode character set. The second problem is that although I use a counter variable to determine which part of the code word I am adding to the string, the counter doesn't seem to reset itself properly.
Any input or advice that anyone is willing to contribute to my program would be greatly appreciated. Also, please excuse my amateur style
