Commit bdbea1a8 authored by neil.whitehead's avatar neil.whitehead

13:41 17/12/18

parent c899adb3
Pipeline #543 failed with stages
import java.util.ArrayList;
import java.util.List;
import java.io.*;
public class AssessmentPartFour
{
public class AssessmentPartFour {
List<String> morseCode = new ArrayList<String>();
public int loadMorseFromFile(String filename)
{
return 0;
morseCode = new ArrayList<String>();
try
{
FileReader file = new FileReader (filename);
BufferedReader buffer = new BufferedReader ( file );
String line = "";
while ((line = buffer.readLine()) !=null)
{
morseCode.add(line);
}
//buffer.close(); not needed as try will automatically close
}
catch (IOException e)
{
System.out.println("error");
}
System.out.println(filename + " " + morseCode.size());
return morseCode.size();
}
public String translateMorse()
{
System.out.println("translate");
System.out.println(morseCode.size());
System.out.println(morseCode.get(0));
for(int i = 0; i < morseCode.size(); i++)
{
System.out.println(morseCode.get(i));
}
return "";
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment