Question: Objective To build a complete working Java program that offers practice with Java string manipulation. Overview & Instruction Write a Java program that performs encryption
Objective To build a complete working Java program that offers practice with Java string manipulation. Overview & Instruction Write a Java program that performs encryption of a given message. You are writing a solution for intelligence officers in hostile nations that must send a coded message back to Washington, DC The encryption must be unbreakable. Your program will receive the following as input: message destination, criticality level, and message content. An example is PWE ARE OUT OF COFFEE The message will be a oneline commadelimited string. The first token of the string should be a onecharacter code representing the destination the message, the second character is a priority code. Then, following only one comma the remaining text is the message you wish to encrypt and send.. Once the message is encoded, your ultimate program output would be something like the following format: To: Pentagon URGENT Message: xxxxxxxxxxxxxxxxxxxx Your encryption routine should: Convert the message to all uppercase characters Remove all blanks spaces Reverse the string Shift the characters not underscores to the "right" based a key read in from an external file. See below. The key will be a twodigit number read in from an external file. This simulates that the key would be a changeable feature. The sender and receiver would know the key. For example, if the key was on a given day: shift first character two position, the second character five positions, the third character two positions, the fourth character five positions, and so on Be sure to "wrap" a character AZ if it rolls off the alphabet. For example, if a Y was to be shifted to the right" places, it should wrap to a D Note: To implement this feature, create a simple text file keyshift.txt and save a twodigit number within it Below are specifications related to the destination and criticality codes. The following list includes all possible message destinations: P Pentagon W White House N National Security Agency C Central Intelligence Agency The following list includes all possible criticality codes: URGENT IMPORTANT ROUTINE Design your solution using an object oriented approach. This implies a Message class with at least the following features: Data members: Message Destination code Criticality code Constructor that: Receives a message string Parses breaks up the string to extract and store the destination and criticality codes A method encrypt that performs the required encryption algorithm and returns the encrypted message string. This method should also manage the keyshift.txt file. A validation method that checks the following: The string has exactly one comma with two characters before the comma and at least one after. The destination code and criticality code are both valid. Methods to return the destination name and criticality description strings Your main driver application class can then be narrowed to managing the very simple user interaction as well as method calls to the one Message object in the solution. Include the following tasks: Prompt the user via dialog boxes for the input string. Instantiate the Message object with the input string If the Message object is valid ie "ask the object" if it is valid using the validation method Encrypt the message "Get" the encrypted message destination string and criticality string Formulate the output message and display via a dialog box Otherwise, provide a dialog to the user that the message input was invalid. Finally, note that there is no requirement for code decryption decoding Also, remember that Java String comparison requires use of the equals method instead of
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
