import javax.swing.*;//this imports the swing package so that it can be used in the application import java.lang.String;//this imports the string package import java.io.*;//this imports the input output package import java.awt.*;//this imports the awt package import javax.swing.JTextArea;//this imports the Jtext area class from the swing package public class fortune5//this decleares the main class { /*this is the main method and is responsible for the saving and opening of the files */ public static void main(String args[])throws Exception//this is the main method and is called in the begining { String options,another,s,saveas,saveas1,saveas2; int option; options = JOptionPane.showInputDialog("please input a number"); option = Integer.parseInt(options); while(option != -1) { options = JOptionPane.showInputDialog("please input a number"); option = Integer.parseInt(options); ; saveas1 = JOptionPane.showInputDialog("what would you like to save your file as"); String source1 = "result /n" + option* 7; char buffer1[] = new char[source1.length()]; source1.getChars(0, source1.length(), buffer1, 0); FileWriter f1 = new FileWriter(""+saveas1); f1.write(buffer1); JOptionPane.showMessageDialog(null,"Your file has been save in the directroy this program is runnin in\n input -1 to quit program\nclick ok to continue"); f1.close(); } System.exit( 0 ); // terminate the program } }