Opening a file
So I'm making a program that opens a file that needs to be processed once opened. I've already opened the file on my code. Here is what I've done so far: import java.io.File; import java.io.FileNotFoundException; import java.util.Scanner; { public static void main(String[] args) { try { File myObj = new File("random.txt"); Scanner myReader = new Scanner(myObj); while (myReader.hasNextLine()) { String info = myReader.nextLine(); System.out.println(info + " "); } myReader.close(); } catch (FileNotFoundException e) { System.out.println("Something's gone wrong"); e.printStackTrace(); } } } However, it needs to to do the following as well: - get the original file name (with or without path) from the user. - specify the output file name (with or without path). - allow the user to set the field width and set the precision (after decimal point). - allow the user to set how many columns on each line (must be from 1 to 5) The new file should not be created until: - the input file already exists - the destination file does not exist - the field width is specified - the precision is specified, and - the number of columns is in the range of 1 to 5 I'm struggling heavily on that assignment. Can someone help me on that please?