The letters of the alphabet a through z

Assignment Help JAVA Programming
Reference no: EM13166013

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:

Create a class called MorseCode that has at least the following two methods: (1) a method with signature toMorseCode(char) that accepts a single capital letter from the English alphabet and returns an array of 4 characters representing the Morse code equivalent of that letter, and (2) a method with signature fromMorseCode(char[4]) that 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. The first, of type char[], will store the 26 letters of the alphabet. The second, of type char[][], will store the Morse code for each of the 26 letters of the alphabet.

Create a driver class called TestMorseCode. At a minimum

    When the program runs, it should first print its name
    The program should next ask the user first whether the original input will be in English or in Morse code
    Based on the answer, the program will ask the user to enter either a phrase in English, or the Morse code for a phrase
    If the user is entering an English phrase, a carriage return will indicate the end of the phrase. If the user is entering Morse code, any character other than . (dot), - (dash), or space will indicate the end of the phrase
    The program will then print the result after conversion
    Your source code must conform to good programming style, with all comments in Javadoc format.

Here is an example of its execution:

    Morse Code Conversion Program.
    This program reads a phrase in English (or Morse code) and prints
    its equivalent in Morse code (or English).

    If your original message is in English, please enter an E.  If it
    is in Morse code, please enter an M.  Enter any other character to
    quit: E

    Please enter a phrase in English, followed by a carriage return:
    PARTY ON

    The Morse code for your phrase is:
    .--..-  .-. -   -.--    --- -. 

    Goodbye.


    Morse Code Conversion Program.
    This program reads a phrase in English (or Morse code) and prints
    its equivalent in Morse code (or English).

    If your original message is in English, please enter an E.  If it
    is in Morse code, please enter an M.  Enter any other character to
    quit: M

    Please enter a phrase in Morse code, followed by a carriage return:
    .....   .-...-..---

    Your phrase in English is:
    HELLO

    Goodbye.

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 ..-

Reference no: EM13166013

Questions Cloud

Your manager has decided that the throughput : Your manager has decided that the throughput of your file server can be improved by replacing your old SCSI-2 host adapter with a "fast and wide" SCSI-3 adapter. It has also been decided that the old SCSI-2 drives will be replaced with "fast and w..
Untreated psychotic illness : Can a person with an untreated psychotic illness have total loss of recall for a violent incident for which he was alleged to be responsible by bystanders who recognised him?
State contains a mixture of neon and fluorine : A closed vessel of volume3.0L contains a mixture of neon and fluorine. The total pressure is3.37atm at 0.0°C. When the mixture is heated to 15°C, the entropy of the mixture increases by 0.345 J·K-1
How much potassium nitrate has to dissolve in water : How much potassium nitrate has to dissolve in water to absorb 114 kJ of heat?
The letters of the alphabet a through z : 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 ..
Debate pertaining to cruel and unusual punishment : What are the main provisions of the 8th Amendment and explain both sides of the debate pertaining to cruel and unusual punishment and the related constitutional issues. Is ethics involved in this debate, If so how?
State reach the equivalence point in the titration : Find the pH of the equivalence point and the volume (mL) of 0.0740 M KOH needed to reach the equivalence point in the titration
Product life cycle and integrated marketing : Discuss integrated marketing communications and the communication process.  Describe the promotional mix. How does the promotional mix change over the product life cycle?
State the ph of the solution resulting from the addition : What is the pH of the solution resulting from the addition of 25.0 mL of .01M NaOH solution to 40.0 mL of .01M acetic acid

Reviews

Write a Review

JAVA Programming Questions & Answers

  Return a reverse queue

represent my queue object as a parameter, what the program should be doing. It should return a reverse queue

  Identify the first character of the name and lengthof length

Write a Java application that stores the names of your family and friends in a one-dimensional array of Strings. The program should show all names in upper case and lower case, identify the first character of the name, and the lengths of the names.

  Design java program to enter name in input dialog box

Design the program called MailingLabel.java Program must ask user to enter name and address in input dialog box with each component of address seperated by comma.

  Program that counts the number of occurrences of lowercase

Write a program that counts the number of occurrences of lowercase and uppercase vowels in entered lines of text. Use a two-dimensional array to store the vowel counts. The array's first column holds the counts for the lowercase vowels, and the secon..

  Method splitstack that takes a stack

Write a method splitStack that takes a stack of integers as a parameter and splits it into negatives and non-negatives. The numbers in the stack should be rearranged so that all the negatives appear on the bottom of the stack and all the non-negat..

  Java program to print strings given at command line

Write down program Average.java to print strings which it is given at command line, one per line. If nothing is given at command line, then print "No arguments".

  Mvc pattern and servlet

When you use the MVC pattern, the controller directs the flow of control to

  Finding java code error

Indicate in the given code segment if an error occurs. If so, point to whether it is syntax, runtime or logic and how you would fix it.

  Write a java applet for grade of gas in costco gas station

Write a java applet (not a java application program) for costco gas station. The applet will first ask you whether you are a costco customer, then the grade of gas you want to use.

  Huge integer class

Huge Integer Class) Create a class HugeInteger which uses a 40-element array of digits to store integers as large as 40 digits each. Provide methods parse, toString, add and subtract. Method parse should receive a String, extract each digit using met..

  Java :a user-defined starting position (other than 0,0)

modifying the program so that it can start from a user-defined starting position (other than 0,0) and search for a user defined ending point (other than row-1, column-1) .

  Design a class named large integers

Design a class named largeIntegers such that an object of this class can store an integer of any number of digits.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd