Skip to content
Snippets Groups Projects
Main.java 1.09 KiB
Newer Older
  • Learn to ignore specific revisions
  • Alexis Nasr's avatar
    Alexis Nasr committed
    import java.io.*;
    import java.util.Scanner;
    
    /*** Methode Main : Lire le fichier donné et créer un tableau 2D qui contint le characters du fichier. 
     *** Demander un mot d'utilisateur et le chercher dans le tableau 
     *** Visualiser the tableau avec le mot trouver ou informer l'utilisatuer si le mot n'est pas present */ 
    
    public class Main {
    
        public static void main(String args[]) throws IOException {
    
    Teo Blaise Kaplanski's avatar
    Teo Blaise Kaplanski committed
        	
        	
    
    Alexis Nasr's avatar
    Alexis Nasr committed
    
    	String filename;
    
    Teo Blaise Kaplanski's avatar
    Teo Blaise Kaplanski committed
    	Scanner input = new Scanner(System.in);
    
    Alexis Nasr's avatar
    Alexis Nasr committed
    	// Demander le nom de Fichier à l'utisateur
    
    Teo Blaise Kaplanski's avatar
    Teo Blaise Kaplanski committed
    	System.out.println("filename:");
    	
    	filename = input.next();
    	File file = new File(filename);
    	if(file.exists())
    		System.out.println("File exists");
    	else System.exit(1);
    	// Construire une instance de la classe "Crossword"	
    	Crossword tableau = new Crossword(file);
    	
    	tableau.display();
    	tableau.search("MA");
    	
    	
    	System.out.println("Nombre de fois : " + tableau.countWord("MA"));
    	
    	
    
    Alexis Nasr's avatar
    Alexis Nasr committed
    	
    
    	// Demander un mot à chercher ...
    	// Utiliser la méthode Crossword.search() pour chercher le mot
    	// Ecrire un message sur le terminal pour informer l'utilisateur du resultat. 
    	
        }
    }