@@ -0,0 +1,2318 @@
+import java.io.*;%0Aimport java.util.*;%0A%0Aclass LeggiFile%7B%0A%0A  public static String riga;%0A%0A/*legge dal file nomeFile una riga alla volta e%0A  la stampa (la visualizza sul terminale).*/%0A  static void leggiRighe(File inFile,Scanner in)%7B%0A    while(in.hasNextLine())%7B%0A      riga=in.nextLine();%0A      System.out.println(riga);%0A    %7D%0A  %7D%0A%0A/*legge dal file nomeFile una stringa alla volta e la stampa.*/%0A  static void leggiParole(File inFile,Scanner in)%7B%0A    while(in.hasNext())%7B%0A      riga=in.next();%0A      System.out.println(riga);%0A    %7D%0A  %7D%0A%0A/*legge dal file nomeFile un numero alla volta, ne calcola la somma%0Ae la stampa.*/%0A  static void leggiNumeri(File inFile,Scanner in)%7B%0A    int n=0;%0A    int somma=0;%0A    while(in.hasNextInt())%7B%0A      n=in.nextInt();%0A      somma=somma+n;%0A    %7D%0A    System.out.println(somma);%0A  %7D%0A/*estrae dal file nomeFile stringhe separate da '-' e le stampa.*/%0A  static void estraiParole(File inFile,Scanner in)%7B%0A    while(in.hasNext())%7B%0A        riga=in.nextLine();%0A        if(riga.equals(%22-%22))%7B%0A          System.out.println(%22 %22);%0A        %7D%0A        System.out.println(riga);%0A     %7D%0A  %7D%0A%0A  public static void main(String%5B%5D args) throws IOException %7B%0A    char scelta =' ';%0A    Scanner input = new Scanner(System.in);%0A%0A    File inFile = new File(%22righe.txt%22);%0A    Scanner in = new Scanner(inFile);%0A%0A    System.out.println(%22Cosa vuoi fare?%22);%0A    System.out.println(%22r) Leggi Righe.%22);%0A    System.out.println(%22p) Leggi Parole.%22);%0A    System.out.println(%22n) Leggi Numeri.%22);%0A    System.out.println(%22e) Estrai Parole.%22);%0A    System.out.println(%22u) ESCI.%5Cn%22);%0A    scelta=input.next().charAt(0);%0A%0A%0A    switch(scelta)%7B%0A        case 'r':%0A          inFile = new File(%22righe.txt%22);%0A          in = new Scanner(inFile);%0A          leggiRighe(inFile,in);%0A          break;%0A        case 'p':%0A          inFile = new File (%22parole.txt%22);%0A          in = new Scanner(inFile);%0A          leggiParole(inFile,in);%0A          break;%0A        case 'n':%0A          inFile = new File (%22numeri.txt%22);%0A          in = new Scanner(inFile);%0A          leggiNumeri(inFile,in);%0A          break;%0A        case 'e':%0A          inFile = new File (%22testo.txt%22);%0A          in = new Scanner(inFile);%0A          estraiParole(inFile,in);%0A          break;%0A        case 'u':%0A            System.out.println(%22%5Cn ARRIVEDERCI %5Cn%22);%0A          break;%0A    %7D%0A  %7D%0A%7D%0A

Create LeggiFile.java