Question: In Java. Professor Potter, a punning pedantic, practices puzzling her students. She has left a secret message, of unknown length, encoded in a file for

In Java.

Professor Potter, a punning pedantic, practices puzzling her students. She has left a secret message, of unknown length, encoded in a file for you to unravel. The setup is simple: each line of the file contains one char and one non-negative integer. The key to reading the message is organizing the characters in the proper order. The integer indicates the position of the character within the message.

Write a program that will:

  1. Ask the user for the name of a file
  2. Check to see that the file exists and contains some data.
  3. Open and read this file exactly once
  4. Using your MessageDecoder class, unravel and display the message
  5. Offer to do it again on another file

Required classes:

You will create and submit 2 classes:

MessageDecoder class:

  • Responsible for converting a scrambled message file into plain text.
  • Contains a public method getPlainTextMessage() that returns the String object.
  • The scrambled file must be scanned only once and must be scanned inside this class.
  • Must utilize the linked list data structure to accomplish the decoding work. (See Lab 4 & Lab 5)
  • Does not call any methods of SecretMessage class

SecretMessage class:

  • Contains the main() method
  • All of printing to console must be done in this class
  • All of user input from the keyboard must be performed in this class
  • Uses the public methods of your MessageDecoder class to accomplish the decoding.

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!