I'm having trouble with my code, I am new to Java and can not seem to understand how to correct the issue. Please review my code and let me know what I am doing wrong. The more detailed the answer the better it would be for me, this is for a homework assignment. I have underlined all the areas where I am getting an error.
package contactinformation; import java.io.*; import javax.swing.*; /** * * @author Daddy */ public class ContactInformation { BufferedWriter out; String name; String phone =""; String strInput; int repeat; int age; String email =""; /** * */ public ContactInformation (){ //JFrame size final int width = 640, height = 480; JFrame window = new JFrame ("Contact Information Program"); //Width and Height set window.setSize(width, height); //specify what happens when x is clicked window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); //display the window window.setVisible(true); do { // Used to input name name = JOptionPane.showInputDialog(null, "Enter name of person." + ""); //Used to input age strInput = JOptionPane.showInputDialog(null, "Enter the persons " + "age."); age = Integer.parseInt(strInput); //validate age entry between 0-120 if (age < 0){ if (age > 120){ JOptionPane.showMessageDialog(null, "You have entered a value that" + " is incorrect. Please enter persons age between 0-120." + ""); } } else { //Used to input email address email = JOptionPane.showInputDialog(null, "Enter Email address."); //Used to input phone number phone = JOptionPane.showInputDialog(null, "Enter Phone Number."); } //did the user need another person added? repeat = JOptionPane.showConfirmDialog(null, "Would you like to" + " enter another person's data?", "Please Confirm.", JOptionPane.YES_NO_OPTION); //File created from data entered } while (repeat==JOptionPane.YES_OPTION); try { out = new BufferedWriter(new FileWriter("ContactData.txt", true)); out.write(name + " "); out.write(age + " "); out.write(email + " "); out.write(phone + " " ); out.newLine(); out.close(); } catch (IOException e) { System.out.println("There was a problem:" + e); } } public static void main(String[] args){ ContactInformation contactInformation = new ContactInformation(); } } [u] public boolean isInteger( String input )[/u] { try { Integer.parseInt(strInput); [u][/u] return true; }[u][u] catch(NumberFormatException e) { System.out.println("Not a number " + e); [u][/u] return false; /** * * @author Daddy */ }[u][/u] [u][/u]public class ReadFile { BufferedReader in; String read; String output; JTextArea show; public ReadFile() { JTextArea show = new JTextArea(20, 40); try { //open a buffered reader to file in = new BufferedReader(new FileReader("ContactData.txt")); while ((read = in.readLine()) != null) { show.setText(read); } } catch(IOException f) { System.out.println("There is a problem." + f); } } } [u][/u] public static void main(String[] args) { new ContactInformationProgram (); }[u][/u]