Question: Provide and fix the inputBinaryCode class so it properly translates from binary to english or morse code. the program code provided is designed to convert

Provide and fix the inputBinaryCode class so it properly translates from binary to english or morse code.
the program code provided is designed to convert between english, morse code and binary (ascii) code. the main program and all classes except the inputbinarycodemessage and outputbinarycodemessage classes are implemented. therefore, you must implement these two unimplemented classes and do program testing. following is a class diagram for the program, given in a uml class diagram. note: message files may contain only upper-case characters, spaces and a period. java
Here is the current codes I have, currently there seems to be a problem for the binary input class: Binary Code data table:A01000001
B01000010
C01000011
D01000100
E01000101
F01000110
G01000111
H01001000
I01001001
J01001010
K01001011
L01001100
M01001101
N01001110
O01001111
P01010000
Q01010001
R01010010
S01010011
T01010100
U01010101
V01010110
W01010111
X01011000
Y01011001
Z01011010
MorseCode data table: 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--..
Exception Classes://By James Edward Bramble, Section 003
package Exceptions;
public class InvalidBinaryCodeFoundException extends RuntimeException {
public InvalidBinaryCodeFoundException(){
super();
}
}
//By James Edward Bramble, Section 003
package Exceptions;
public class InvalidCharFoundException extends RuntimeException {
public InvalidCharFoundException(){
super();
}
public InvalidCharFoundException(String str){
super(str);
}
}
//By James Edward Bramble, Section 003
package Exceptions;
public class InvalidMessageTypeException extends RuntimeException {
public InvalidMessageTypeException(){
super();
}
public InvalidMessageTypeException(String str){
super(str);
}
}
Input Message Classes:
//By James Edward Bramble, Section 003
package InputMessageTypes;
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.FileNotFoundException;
import java.io.IOException;
// Import Project Classes
import Exceptions.InvalidCharFoundException;
public class InputBinaryCodeMessage extends InputMessage {
//Instance Variables
private String line_read = null;
private String line_buffer;
private int current_char_index;
private String last_binary_letter_read ="";
private String[][] binary_code = new String[26][2];
private String binary_code_filename ="./Data/BinaryCode_Table.txt";
//Constructor
public InputBinaryCodeMessage(BufferedReader input) throws
FileNotFoundException, IOException {
super(input);
populateBinaryCode(binary_code_filename);
}
// Character-Ordinal Conversion Methods
public int getOrdinal(String binary_str){
//-----------------------------------------------------------
// Returns ordinal value (position) of chr in the encoding.
//-----------------------------------------------------------
int ordinal_value =0;
for (int i =0; i < binary_code.length; i++){
if (binary_code[i][1].equals(binary_str)){
ordinal_value = i;
}
}
return ordinal_value;
}
// Input Reading Methods
public String readLetter() throws IOException, InvalidCharFoundException {
//-----------------------------------------------------------
// Reads and returns next Binary-encoded letter from input file
// or null if end-of-file found.
//
// Also sets previous_binary_letter to current value of
// binary_letter, and sets binary_letter to new letter read.
//-----------------------------------------------------------
// Check for end-of-file
if (line_read == null){
line_read = getNextLine();
if (line_read == null){
return null;
}
line_buffer = line_read.trim();
current_char_index =0;
}
// Check if we need to read a new line
if (current_char_index >= line_buffer.length()){
line_read = getNextLine();
if (line_read == null){
return null;
}
line_buffer = line_read;
current_char_index =0;
}
// Check for invalid Binary code found
if (current_char_index >= line_buffer.length()){
throw new InvalidCharFoundException("Incomplete binary data");
}
String binary_letter = line_buffer.substring(current_char_index, current_char_index +8);
current_char_index = current_char_index +8;
// Validate that the binary represent

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 Programming Questions!