Question: Write a program that will decode a secret message (file on BlackBoard) You should read the secret message character by character. To decode, you will

Write a program that will decode a secret message (file on BlackBoard) You should read the secret message character by character. To decode, you will need to add 5 to each ASCII character read; for instance if you read ASCII 81 ("Q") you should advance it to ASCII 86 ("V"). The valid range of ASCII characters should be from 32 to 122. If your addition of 5 places an ASCII character out of this range, it will need to "loop around" to the start of the range, i.e., if you get a new ASCII value of 123, you should instead decode as ASCII 32. As you read each character from H:\secretMessage.txt, you should write the decoded character to H:\decodedMessage.txt. Use a try with resources! If you encounter an ASCII character outside the range (32 - 122) throw an IndexOutOfBoundsException with a descriptive message. When you catch the IOException, write the Exception object to the console. When you catch the IndexOutOfBoundsException, write that nice descriptive message to the console.

secret message is

Gpf`vNftr\gf`mvdnv\gdq`v\i_vgdqdibvdiv\vhjpio\dijpnvuji`vjivoc`vkg\i`ov                                            

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!