Commit d819f5ea authored by Romain's avatar Romain

update

parent c899adb3
Pipeline #422 canceled with stages
import java.io.BufferedReader;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Scanner;
public class AssessmentPartFour { public class AssessmentPartFour {
List<String> morseCode = new ArrayList<String>(); List<String> morseCode = new ArrayList<String>();
public int loadMorseFromFile(String filename) public int loadMorseFromFile(String filename) {
{ int number=0;
try (Scanner scanner = new Scanner(new File(filename))) {
// On boucle sur chaque champ détecté.
while (scanner.hasNextLine()) {
String line = scanner.nextLine();
System.out.println(line);
morseCode.add(line);
// Faites ici votre traitement.
System.out.println(morseCode.size());
number=morseCode.size();
}
} catch (FileNotFoundException ex) {
System.out.println("Erreur --" + ex.toString());
}
return 0; return number;
} }
......
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