import java.io.*; import java.util.Random; import javax.swing.*; import javax.swing.JOptionPane; public class ProgramVItwo { public static void main(String args[]) throws IOExeption { int NumberOfValues, RandomNumber; String NameOfDateFile; Random RandomNumberGenerator=new Random(); NumberOfValues=Integer.parseInt( JOptionPane.showInputDialog("Indicate how many values to put in the file: ") ); NameOfDateFile=JOptionPane.showInputDialog("Enter the name of the data file: "); PrintWriter FilObj = new PrintWriter( new FileWriter( NameOfDateFile )); for( int k=0; k < NumberOfValues; k++) { RandomNumber = RandomNumberGenerator.nextInt(); RandomNumber = RandomNumber % 10 + 1; FileObj.printIn( RandomNumber ); } FileObj.close(); } }