Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

File I/O Java Assignment This assignment will give you practice in Handling Exceptions using File I/O and the Adapter Design Pattern. You have been tasked

File I/O Java Assignment

This assignment will give you practice in Handling Exceptions using File I/O and the Adapter Design Pattern.

You have been tasked with implementing Star Trek's Universal Translator for today's cell phones.

Your assignment is to allow a Trekkie to send a text message in any language and have it received it any language.

So far, you only need to be able to translate from Earth languages to Vulcan, Klingon, Ferrengi. However, you need to make your design flexible enough to add additional languages.

Since the main purpose of the assignment is File I/O, Exception Handling and the Adapter Pattern, we will not be coding a complete Universal Translator. All you will need to be able to do is send messages from Earth cell phones to other Earth cell phones, and from Earth cell phones to the Federation Alien languages mentioned above.

You will also need to create a custom exception for languages that are not supported should they be requested.

To simulate the interaction, you will read/write text messages from a file.

You can use any process you would like to do the translation. You might load a small dictionary file(s) and read them into your program. You can maniuplate the words or characters using any algorithm you might like. Remember, the emphasis of this assignment is the exception handling and using the Adapter Design Pattern.

For all programs, catch and handle the Exceptions appropriately and validate the input data where needed.

Also, create your own exception to handle "unknown language" exceptions.

If you want to have a litte bit of fun with this, there are numerous English/Klingon and English/Vulcan dictionaries on the Internet.

Hints:

Use the Media Adapter example as a template.

You will need both the EarthCellPhone and AlienCellPhone interfaces on my code page.

You will need classes that implement these interfaces.

The Alien cell phones do not need to be able to send messages but must be able to read and translate.

After you translate an Earth message to the appropriate Alien language, have the translate method call the Alien readMessage method.

You may use my test code as a guideline only.

Recommendations:

In your user interface, ask the Earth user if he wants to read a message or send a message. If the user wants to send a message, he will need to specify the type of language understood by the recipient. In either case, he will need to specify a filename to save/ read the message.

To send a message, prompt the user for the text and write it to a file.

To read a message, read it from a file.

To send a message to a recipient that speaks an Alien language, it must be translated first before it can be read.

Along with reading/writing to a file, print the contents to the console for verification.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

How To Build A Million Dollar Database

Authors: Michelle Bergquist

1st Edition

0615246842, 978-0615246840

More Books

Students also viewed these Databases questions

Question

8. Praise the trainees for their success in learning the task.

Answered: 1 week ago