/**
* Write a description of class MorseCode here.
*
* @author (Landon L)
* @version (a version number or a date)
*/
import java.util.*;
import java.io.File;
import java.io.IOException;
public class MorseCode
{
private static String[] morse;
private static String phrase;
private static String Newphrase;
/**
* Constructor for objects of class MorseCode
*/
public MorseCode(String p)
{
morse = new String[36];
phrase = p;
Newphrase = "";
}
public static String[] read() throws IOException
{
Scanner in = new Scanner(new File("morsecode.txt"));
String a = phrase;
int i = 0;
while(in.hasNext())
{
String b = in.next();
morse[i] = b;
i++;
}
//for(i = 0; i < morse.length; i++)
return morse;
}
public static void Convert()
{
char[] alpha = {'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'};
char[] num = {'0','1','2','3','4','5','6','7','8','9'};
int i = 0;
int a = 0;
char l;
int b = 0;
phrase = phrase.toLowerCase();
for(i = 0; i < phrase.length(); i++)
{
l = phrase.charAt(i);
if((int) 'l' == 32)
Newphrase += " ";
else if(((int) 'l'>= 99)&& ((int) 'l'<= 122))
{
for ( a = 0 ; a < alpha.length ; a++ )
{
if ( l == alpha[a] )
{
Newphrase += morse[a];
}
}
}
else if(((int) 'l'>= 48)&& ((int) 'l'<= 57))
{
for ( a = 0 ; a < num.length ; a++ )
{
if ( l == num[a] )
{
Newphrase+= morse[a+25];
}
}
}
}
}
public static String getNewPhrase()
{
return Newphrase;
}
}