Question: To get more practice for your final project you will utilize all the skills that youve learn so far. Your program will be able to
To get more practice for your final project you will utilize all the skills that youve learn so far. Your program will be able to take in user inputs or read an external data collection (in this case, a text file), then report information back to the user based on user inputs. To accomplish this, your program must perform the following actions:
A) Prompt the user for the option to encode or decode.
B) Prompt the user for the option to read from file or user entry.
C) Prompt the user for the name of the file.
D) Handle exceptions and re-prompt for the file should the user provide an erroneous input.
E) Inform the user that the results have been saved as a text file.
F) Use an array to store the ASC II code.
G) Print the results in the compiler console.
H) Print and save the results in a text file.
I) Include appropriate program documentation and formatting including:
1) Your first and last name, your email information, and the date
2) A short description of the programs function
3) Comments necessary to explain your code
4) Proper indentation and convention
5) Correct output
J) Save your file as Coder.java and upload to Canvas.
A Sample logs of execution is as follow (user inputs are in bold and underlined):
Would you like to encode or decode? encode
Is it a file? No
How many words? 3
What would you like to encode? Try, Try again!
Save the results as: results.txt
ASCII value of "Try, Try again!" is following
[84, 114, 121, 44, 32, 84, 114, 121, 32, 97, 103, 97, 105, 110, 33]
The result have been saved as a text file: results.txt
Would you like to encode or decode? encode
Is it a file? Yes
What would you like to encode? decode.txt
Save the results as: save.txt
ASCII value of "Its finally done!" is following
[73, 116, 39, 115, 32, 102, 105, 110, 97, 108, 108, 121, 32, 100, 111, 110, 101, 33]
The result have been saved as a text file: save.txt
Tips:
1) File names are case sensitive.
2) The file to be read must be in the project folder in order to run.
3) There are multiple ways to handle exceptions. The only thing you cannot do is ignore its possibility. You can also use a construct called a Try-Catch block to handle this exception, rather than (or in addition to) the throws clause in the method header.
4) The Scanner.close() method is used to prevent memory leaks caused by scanner objects failing to return their memory to the available pool. You cannot redeclare a closed() Scanner object, as in a While loop. Doing so will throw an exception. To properly close a Scanner, use the close() method only when you are certain that the Scanners role in the program is completely finishe
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
