import java.io.File; import java.io.FileNotFoundException; import java.io.PrintWriter; import java.util.Scanner; /** This program reads a file with numbers, and writes the numbers to another file, lined up in a column and followed by their total. */ public class csvRead { public static void main(String[] args) throws FileNotFoundException { // Prompt for the input and output file names Scanner console = new Scanner(System.in); System.out.print("Input file: "); String inputFileName = console.next(); // Construct the Scanner and PrintWriter objects for reading and writing File inputFile = new File(inputFileName); Scanner in = new Scanner(inputFile); // Read the input and write the output while (in.hasNextLine()) { String line = in.nextLine(); String [] parts=line.split(";"); System.out.println("." + Integer.parseInt(parts[0]) + " - " +parts[1]); } in.close(); } }