Welcome to the Most Reliable, Essay Writing Service on the internet

the-letters-of-the-alphabet-a-through-z-can-be-represented-in-morse-code-2

Mar 23

JAVA JAVA for Eclipse

Objective:

The letters of the alphabet A through Z can be represented in Morse code. Each letter is represented by a combination of up to four dots and/or dashes, as shown below. Use Java to write and run a console-window program that can convert an English message into Morse code or a Morse code message into English. The program must satisfy the following requirements:

Description:

Create a class called MorseCode that at least has methods with the following signatures:

  • toMorseCode(char letter) – accepts a single capital letter from the English alphabet and returns an array of 4 characters representing the Morse code equivalent of that letter.
  • fromMorseCode(char[] arr) – accepts an array of four Morse code characters (each either a dot, a dash, or space) and returns the English letter equivalent.

The MorseCode class will have two static variables:

  • char[] alphabet – An array of all 26 letters in the alphabet.
  • char[][] morseCodeAlphabet – an array of arrays of char, storing the morse code entries for all 26 letters of the alphabet.

Create a class AlphabetException. This class should extend Exception, and be used in case the user enters an invalid character in EITHER mode. For example, if the user wants to convert from English to Morse and enters a lower-case letter, your program should throw an AlphabetException.

Create a driver class called TestMorseCode. At a minimum

  1. The program should print its name
  2. The program should (continually) ask the user to whether the original phrase will be in English or Morse
  3. For each iteration, the program should ask the user for a phrase (either in English or Morse, depending on the previous choice)
  4. For each iteration, the program will print the result of the conversion (either English to Morse or Morse to English)
    • If the user enters an invalid character, your program should check for an AlphabetException and print an appropriate message.
    • After the error, your program should continue on the next iteration of the main loop (i.e. your program should NOT quit if the user enters an invalid phrase)
  5. Your source code must conform to good programming style, with Javadoc comments on all public methods.

Example:

 Morse Code Conversion Program.
 This program reads a phrase in English(or Morse code) and prints its equivalent in Morse code (or English)
 Please select one [1-3]:
 1: English -> Morse
 2: Morse -> English
 3: Quit
 1
 Enter an English phrase:
 PARTY ON
 .--. .- .-. - -.-- / --- -.

 Please select one [1-3]:
 1: English -> Morse
 2: Morse -> English
 3: Quit
 2
 Enter a Morse phrase:
 .--. .- .-. - -.-- / --- -.
 PARTY ON

 Please select one [1-3]:
 1: English -> Morse
 2: Morse -> English
 3: Quit
 1
 Enter an English phrase:
 this will cause an error
 Letter 't' not in alphabet
 Aborting conversion

 Please select one [1-3]:
 1: English -> Morse
 2: Morse -> English
 3: Quit
 3
 

Conversion Table:

 A .- H .... O --- V ...-
 B -... I .. P .--. W .--
 C -.-. J .--- Q --.- X -..-
 D -.. K -.- R .-. Y -.--
 E . L .-.. S ... Z --..
 F ..-. M -- T -
 G --. N -. U ..-
 

ADDITIONAL DOC:

To save time here is the code for the above table

 private static char[][]
 morseCodeAlphabet = { { '/' }
 , { '.', '-' }
 , { '-', '.', '.', '.' }
 , { '-', '.', '-', '.' }
 , { '-', '.', '.' }
 , { '.' }
 , { '.', '.', '-', '.' }
 , { '-', '-', '.' }
 , { '.', '.', '.', '.' }
 , { '.', '.' }
 , { '.', '-', '-', '-' }
 , { '-', '.', '-' }
 , { '.', '-', '.', '.' }
 , { '-', '-' }
 , { '-', '.' }
 , { '-', '-', '-' }
 , { '.', '-', '-', '.' }
 , { '-', '-', '.', '-' }
 , { '.', '-', '.' }
 , { '.', '.', '.' }
 , { '-' }
 , { '.', '.', '-' }
 , { '.', '.', '.', '-' }
 , { '.', '-', '-' }
 , { '-', '.', '.', '-' }
 , { '-', '.', '-', '-' }
 , { '-', '-', '.', '.' }
 };

 private static char[] alphabet = { ' ', 'A', 'B', 'C', 'D'
 , 'E', 'F', 'G', 'H', 'I'
 , 'J', 'K', 'L', 'M', 'N'
 , 'O', 'P', 'Q', 'R', 'S'
 , 'T', 'U', 'V', 'W', 'X'
 , 'Y', 'Z' };
  

CLIENT TESTIMONIALS

The Service Is Okay. I won’t Complain

The writers on the website are courteous and the customer service responds quickly. My paper was handled well; They promised...

Writers here are very professional and are native British

Thanks a lot for helping me out with my PhD Thesis, Writers here are very professional and are native British!!

Jack, The United Kingdom

Very Very Helpful, and On time.

Very Very Helpful, and On time.

Adelio M, Spain

I scored complete A’s in 3 out of four courses

I scored complete A’s in 3 out of four courses

Anonymous, Illinoi Chicago

CLICK HERE  To order your paper

About Essaysmiths Assignment writing service

We are a professional paper writing website. If you have searched a question and bumped into our website just know you are in the right place to get help in your coursework. We offer HIGH QUALITY & PLAGIARISM FREE Papers.

How It Works

To make an Order you only need to click on “Order Now” and we will direct you to our Order Page. Fill Our Order Form with all your assignment instructions. Select your deadline and pay for your paper. You will get it few hours before your set deadline.

Are there Discounts?

All new clients are eligible for upto 20% off in their first Order. Our payment method is safe and secure.

 CLICK HERE to Order Your Assignment

 

Get access to cheap essays online, and forget about all your worries

Quality assurance

When we accept your assignment order, we treat it with the utmost seriousness. This means that only the best experts will conduct research on your topic and that they will deliver your paper only after making sure that it is insightful.

Total confidentiality

We use the SSL protocol to ensure that all the details of our customers are 100% safe and secure. So, forget about all worries when sharing personal information on our site. We never disclose the details of our clients.

All round service

24/7 customer support. We don’t want you to fail to submit your paper. So, we work 24 hours a day and 7 days a week to provide you with instant feedback.

Original Essays

One of the key principles of our work is to be creative and original. We hire only talented and experienced essay writers that are able to create authentic papers. Each regular essay or term paper is written from scratch in accordance with all your guidelines.

Cheap Service

Compared to our competitors, we offer a relatively cheap service. We allow you the comfort of a cheap paper writing service to improve your grades. If you are facing an academic problem, we’ll solve it by asking for a fair price.

Rocket fast Essay writing service

Don’t worry! We work in a timely manner to deliver orders before the due date. You’ll have enough time to check whether the finished paper corresponds to all your requirements. If not, provide us with feedback and ask for a revision.

Order Your Essay Today From  reliable Essay writing Service.

Order your Assignment today and save 15% with the discount code ESSAYHELP

X