Reference no: EM132210405
Question :
You are to write a program in Java that takes in as input a string message and an integer.
The program will then scramble the message by converting each character of the message to its numeric code, adding the specified integer to this code, and then converting the resulting number back to a character.
To do this, you must create a class that handles a string and an encoding integer.
ALGORITHM: You are to perform a top-down modular design for this and all following programming projects. In this case the design is simple, so you may include it as comments at the top and within the program.
Required Class Variables: Should include a string to hold the message, and an int to hold the value to alter the message by.
Required Member Methods:
encrypt - which will take in a single letter and return a result of type char.
encryptAll - which will manipulate class variables in a loop to encrypt all of them.
getMessage - which will read in and store the message string in a class variable.
getCode - which will read in and store the encoding value.
To make it more readable, make sure that you skip spaces in the string (don't change them). For example, on our ASCII machines, the message:
THE REDCOATS ARE COMING! and the integer 5 would produce.