In this program it says all the lines with "readInt" not found in class java.io.DataInputStream. Also it says in the catch(IOException c) exception java.io.IOException is never thrown in the corresponding try block, I have pointed out the errors so u can see them.
public class SurveyTest extends Applet implements ActionListener { DataInputStream input; DataOutputStream output; Label surveyNameLabel = new Label ("NHS Parental Survey"); Label getToWorkLabel = new Label ("Please Ansewer the Questions to the Best of Your Ability");
Checkbox q1 = new Checkbox("q1"); int q1Total=0; Checkbox q2 = new Checkbox("q2"); int q2Total=0; Checkbox q3 = new Checkbox("q3"); int q3Total=0; Checkbox q4 = new Checkbox("q4"); int q4Total=0; Checkbox q5 = new Checkbox("q5"); int q5Total=0; Checkbox q6 = new Checkbox("q6"); int q6Total=0; Checkbox q7 = new Checkbox("q7"); int q7Total=0; Checkbox q8 = new Checkbox("q8"); int q8Total=0; Checkbox q9 = new Checkbox("q9"); int q9Total=0; Checkbox q10 = new Checkbox("q10"); int q10Total=0; Button submitButton = new Button("Submit Results"); int counter=0;
public void init() { setBackground(Color.cyan); add(surveyNameLabel); add(getToWorkLabel);
setLayout(new GridLayout(11,1)); Panel panels[]=new Panel[11]; for(int i=0;i<panels.length;++i) { panels=new Panel(); panels.setLayout(new FlowLayout(FlowLayout.LEFT)); } panels[0].add(q1); panels[1].add(q2); panels[2] .add(q3); panels[3].add(q4); panels[4].add(q5); panels[5].add(q6); panels[6].ad d (q7); panels[7].add(q8); panels[8].add(q9); panels[9].add(q10); panels[10].add( s ubmitButton); submitButton.addActionListener(this); for(int i=0;i<panels.length;i++) { add(panels); } //Open File to read data try { input = new DataInputStream(new FileInputStream("Survey.dat")); } catch(IOException ex) { System.exit(1); } //read data try { input.readInt(q1Total);//Error here input.readInt(q2Total);//Error here input.readInt(q3Tota l);//Error here input.readInt(q4Total);//Error here input.readInt(q5Total);//Error here input.readInt(q6Total);//Error here inpu t.readInt(q7Total);//Error here input.readInt(q8Total);//Error here input.readInt(q9Total);//Error here input.readIn t(q10Total);//Error here input.readInt(counter);//Error here } catch(IOException c)//Error here { System.exit(1); } } //Do stuff at button's click public void actionPerformed(ActionEvent e) { String arg = e.getActionCommand(); try { output = new DataOutputStream(new FileOutputStream("Survey.dat")); } catch(IOException op) { System.exit(1); } try { q1Total+=toDigit(q1); q2Total+=toDigit(q2); q3Tot al+=toDigit(q3); q4Total+=toDigit(q4); q5Total+=toDigit(q5); q6Total+=toDigit(q 6 ); q7Total+=toDigit(q7); q8Total+=toDigit(q8); q9Total+=toDigit(q9); q10Total+= t oDigit(q10); counter++; } catch(Exception cng) { System.exit(1); } //write data to files try { output.writeInt(q1Total); output.writeInt(q2Total); output.writeInt (q3Total); output.writeInt(q4Total); output.writeInt(q5Total); output.writeInt( q 6Total); output.writeInt(q7Total); output.writeInt(q8Total); output.writeInt(q9 T otal); output.writeInt(q10Total); output.writeInt(counter); } catch(IOException wt) { System.exit(1); } } //change checkboxes to int int toDigit(Checkbox ch) { boolean state = ch.getState(); if(state) return (1); else return (0); } } import java.io.*; import java.awt.*; import java.awt.event.*; import java.applet.*;
public class SurveyTest extends Applet implements ActionListener { DataInputStream input; DataOutputStream output; Label surveyNameLabel = new Label ("NHS Parental Survey"); Label getToWorkLabel = new Label ("Please Ansewer the Questions to the Best of Your Ability");
Checkbox q1 = new Checkbox("q1"); int q1Total=0; Checkbox q2 = new Checkbox("q2"); int q2Total=0; Checkbox q3 = new Checkbox("q3"); int q3Total=0; Checkbox q4 = new Checkbox("q4"); int q4Total=0; Checkbox q5 = new Checkbox("q5"); int q5Total=0; Checkbox q6 = new Checkbox("q6"); int q6Total=0; Checkbox q7 = new Checkbox("q7"); int q7Total=0; Checkbox q8 = new Checkbox("q8"); int q8Total=0; Checkbox q9 = new Checkbox("q9"); int q9Total=0; Checkbox q10 = new Checkbox("q10"); int q10Total=0; Button submitButton = new Button("Submit Results"); int counter=0;
public void init() { setBackground(Color.cyan); add(surveyNameLabel); add(getToWorkLabel);
setLayout(new GridLayout(11,1)); Panel panels[]=new Panel[11]; for(int i=0;i<panels.length;++i) { panels=new Panel(); panels.setLayout(new FlowLayout(FlowLayout.LEFT)); } panels[0].add(q1); panels[1].add(q2); panels[2] .add(q3); panels[3].add(q4); panels[4].add(q5); panels[5].add(q6); panels[6].ad d (q7); panels[7].add(q8); panels[8].add(q9); panels[9].add(q10); panels[10].add( s ubmitButton); submitButton.addActionListener(this); for(int i=0;i<panels.length;i++) { add(panels); } //Open File to read data try { input = new DataInputStream(new FileInputStream("Survey.dat")); } catch(IOException ex) { System.exit(1); } //read data try { input.readInt(q1Total); input.readInt(q2Total); input.readInt(q3Tota l); input.readInt(q4Total); input.readInt(q5Total); input.readInt(q6Total); inp u t.readInt(q7Total); input.readInt(q8Total); input.readInt(q9Total); input.readI n t(q10Total); input.readInt(counter); } catch(IOException c) { System.exit(1); } } //Do stuff at button's click public void actionPerformed(ActionEvent e) { String arg = e.getActionCommand(); try { output = new DataOutputStream(new FileOutputStream("Survey.dat")); } catch(IOException op) { System.exit(1); } try { q1Total+=toDigit(q1); q2Total+=toDigit(q2); q3Tot al+=toDigit(q3); q4Total+=toDigit(q4); q5Total+=toDigit(q5); q6Total+=toDigit(q 6 ); q7Total+=toDigit(q7); q8Total+=toDigit(q8); q9Total+=toDigit(q9); q10Total+= t oDigit(q10); counter++; } catch(Exception cng) { System.exit(1); } //write data to files try { output.writeInt(q1Total); output.writeInt(q2Total); output.writeInt (q3Total); output.writeInt(q4Total); output.writeInt(q5Total); output.writeInt( q 6Total); output.writeInt(q7Total); output.writeInt(q8Total); output.writeInt(q9 T otal); output.writeInt(q10Total); output.writeInt(counter); } catch(IOException wt) { System.exit(1); } } //change checkboxes to int int toDigit(Checkbox ch) { boolean state = ch.getState(); if(state) return (1); else return (0); } }import java.io.*; import java.awt.*; import java.awt.event.*; import java.applet.*;
public class SurveyTest extends Applet implements ActionListener { DataInputStream input; DataOutputStream output; Label surveyNameLabel = new Label ("NHS Parental Survey"); Label getToWorkLabel = new Label ("Please Ansewer the Questions to the Best of Your Ability");
Checkbox q1 = new Checkbox("q1"); int q1Total=0; Checkbox q2 = new Checkbox("q2"); int q2Total=0; Checkbox q3 = new Checkbox("q3"); int q3Total=0; Checkbox q4 = new Checkbox("q4"); int q4Total=0; Checkbox q5 = new Checkbox("q5"); int q5Total=0; Checkbox q6 = new Checkbox("q6"); int q6Total=0; Checkbox q7 = new Checkbox("q7"); int q7Total=0; Checkbox q8 = new Checkbox("q8"); int q8Total=0; Checkbox q9 = new Checkbox("q9"); int q9Total=0; Checkbox q10 = new Checkbox("q10"); int q10Total=0; Button submitButton = new Button("Submit Results"); int counter=0;
public void init() { setBackground(Color.cyan); add(surveyNameLabel); add(getToWorkLabel);
setLayout(new GridLayout(11,1)); Panel panels[]=new Panel[11]; for(int i=0;i<panels.length;++i) { panels=new Panel(); panels.setLayout(new FlowLayout(FlowLayout.LEFT)); } panels[0].add(q1); panels[1].add(q2); panels[2] .add(q3); panels[3].add(q4); panels[4].add(q5); panels[5].add(q6); panels[6].ad d (q7); panels[7].add(q8); panels[8].add(q9); panels[9].add(q10); panels[10].add( s ubmitButton); submitButton.addActionListener(this); for(int i=0;i<panels.length;i++) { add(panels); } //Open File to read data try { input = new DataInputStream(new FileInputStream("Survey.dat")); } catch(IOException ex) { System.exit(1); } //read data try { input.readInt(q1Total); input.readInt(q2Total); input.readInt(q3Tota l); input.readInt(q4Total); input.readInt(q5Total); input.readInt(q6Total); inp u t.readInt(q7Total); input.readInt(q8Total); input.readInt(q9Total); input.readI n t(q10Total); input.readInt(counter); } catch(IOException c) { System.exit(1); } } //Do stuff at button's click public void actionPerformed(ActionEvent e) { String arg = e.getActionCommand(); try { output = new DataOutputStream(new FileOutputStream("Survey.dat")); } catch(IOException op) { System.exit(1); } try { q1Total+=toDigit(q1); q2Total+=toDigit(q2); q3Tot al+=toDigit(q3); q4Total+=toDigit(q4); q5Total+=toDigit(q5); q6Total+=toDigit(q 6 ); q7Total+=toDigit(q7); q8Total+=toDigit(q8); q9Total+=toDigit(q9); q10Total+= t oDigit(q10); counter++; } catch(Exception cng) { System.exit(1); } //write data to files try { output.writeInt(q1Total); output.writeInt(q2Total); output.writeInt (q3Total); output.writeInt(q4Total); output.writeInt(q5Total); output.writeInt( q 6Total); output.writeInt(q7Total); output.writeInt(q8Total); output.writeInt(q9 T otal); output.writeInt(q10Total); output.writeInt(counter); } catch(IOException wt) { System.exit(1); } } //change checkboxes to int int toDigit(Checkbox ch) { boolean state = ch.getState(); if(state) return (1); else return (0); } }import java.io.*; import java.awt.*; import java.awt.event.*; import java.applet.*;
public class SurveyTest extends Applet implements ActionListener { DataInputStream input; DataOutputStream output; Label surveyNameLabel = new Label ("NHS Parental Survey"); Label getToWorkLabel = new Label ("Please Ansewer the Questions to the Best of Your Ability");
Checkbox q1 = new Checkbox("q1"); int q1Total=0; Checkbox q2 = new Checkbox("q2"); int q2Total=0; Checkbox q3 = new Checkbox("q3"); int q3Total=0; Checkbox q4 = new Checkbox("q4"); int q4Total=0; Checkbox q5 = new Checkbox("q5"); int q5Total=0; Checkbox q6 = new Checkbox("q6"); int q6Total=0; Checkbox q7 = new Checkbox("q7"); int q7Total=0; Checkbox q8 = new Checkbox("q8"); int q8Total=0; Checkbox q9 = new Checkbox("q9"); int q9Total=0; Checkbox q10 = new Checkbox("q10"); int q10Total=0; Button submitButton = new Button("Submit Results"); int counter=0;
public void init() { setBackground(Color.cyan); add(surveyNameLabel); add(getToWorkLabel);
setLayout(new GridLayout(11,1)); Panel panels[]=new Panel[11]; for(int i=0;i<panels.length;++i) { panels=new Panel(); panels.setLayout(new FlowLayout(FlowLayout.LEFT)); } panels[0].add(q1); panels[1].add(q2); panels[2] .add(q3); panels[3].add(q4); panels[4].add(q5); panels[5].add(q6); panels[6].ad d (q7); panels[7].add(q8); panels[8].add(q9); panels[9].add(q10); panels[10].add( s ubmitButton); submitButton.addActionListener(this); for(int i=0;i<panels.length;i++) { add(panels); } //Open File to read data try { input = new DataInputStream(new FileInputStream("Survey.dat")); } catch(IOException ex) { System.exit(1); } //read data try { input.readInt(q1Total); input.readInt(q2Total); input.readInt(q3Tota l); input.readInt(q4Total); input.readInt(q5Total); input.readInt(q6Total); inp u t.readInt(q7Total); input.readInt(q8Total); input.readInt(q9Total); input.readI n t(q10Total); input.readInt(counter); } catch(IOException c) { System.exit(1); } } //Do stuff at button's click public void actionPerformed(ActionEvent e) { String arg = e.getActionCommand(); try { output = new DataOutputStream(new FileOutputStream("Survey.dat")); } catch(IOException op) { System.exit(1); } try { q1Total+=toDigit(q1); q2Total+=toDigit(q2); q3Tot al+=toDigit(q3); q4Total+=toDigit(q4); q5Total+=toDigit(q5); q6Total+=toDigit(q 6 ); q7Total+=toDigit(q7); q8Total+=toDigit(q8); q9Total+=toDigit(q9); q10Total+= t oDigit(q10); counter++; } catch(Exception cng) { System.exit(1); } //write data to files try { output.writeInt(q1Total); output.writeInt(q2Total); output.writeInt (q3Total); output.writeInt(q4Total); output.writeInt(q5Total); output.writeInt( q 6Total); output.writeInt(q7Total); output.writeInt(q8Total); output.writeInt(q9 T otal); output.writeInt(q10Total); output.writeInt(counter); } catch(IOException wt) { System.exit(1); } } //change checkboxes to int int toDigit(Checkbox ch) { boolean state = ch.getState(); if(state) return (1); else return (0); } }import java.io.*; import java.awt.*; import java.awt.event.*; import java.applet.*;
public class SurveyTest extends Applet implements ActionListener { DataInputStream input; DataOutputStream output; Label surveyNameLabel = new Label ("NHS Parental Survey"); Label getToWorkLabel = new Label ("Please Ansewer the Questions to the Best of Your Ability");
Checkbox q1 = new Checkbox("q1"); int q1Total=0; Checkbox q2 = new Checkbox("q2"); int q2Total=0; Checkbox q3 = new Checkbox("q3"); int q3Total=0; Checkbox q4 = new Checkbox("q4"); int q4Total=0; Checkbox q5 = new Checkbox("q5"); int q5Total=0; Checkbox q6 = new Checkbox("q6"); int q6Total=0; Checkbox q7 = new Checkbox("q7"); int q7Total=0; Checkbox q8 = new Checkbox("q8"); int q8Total=0; Checkbox q9 = new Checkbox("q9"); int q9Total=0; Checkbox q10 = new Checkbox("q10"); int q10Total=0; Button submitButton = new Button("Submit Results"); int counter=0;
public void init() { setBackground(Color.cyan); add(surveyNameLabel); add(getToWorkLabel);
setLayout(new GridLayout(11,1)); Panel panels[]=new Panel[11]; for(int i=0;i<panels.length;++i) { panels=new Panel(); panels.setLayout(new FlowLayout(FlowLayout.LEFT)); } panels[0].add(q1); panels[1].add(q2); panels[2] .add(q3); panels[3].add(q4); panels[4].add(q5); panels[5].add(q6); panels[6].ad d (q7); panels[7].add(q8); panels[8].add(q9); panels[9].add(q10); panels[10].add( s ubmitButton); submitButton.addActionListener(this); for(int i=0;i<panels.length;i++) { add(panels); } //Open File to read data try { input = new DataInputStream(new FileInputStream("Survey.dat")); } catch(IOException ex) { System.exit(1); } //read data try { input.readInt(q1Total); input.readInt(q2Total); input.readInt(q3Tota l); input.readInt(q4Total); input.readInt(q5Total); input.readInt(q6Total); inp u t.readInt(q7Total); input.readInt(q8Total); input.readInt(q9Total); input.readI n t(q10Total); input.readInt(counter); } catch(IOException c) { System.exit(1); } } //Do stuff at button's click public void actionPerformed(ActionEvent e) { String arg = e.getActionCommand(); try { output = new DataOutputStream(new FileOutputStream("Survey.dat")); } catch(IOException op) { System.exit(1); } try { q1Total+=toDigit(q1); q2Total+=toDigit(q2); q3Tot al+=toDigit(q3); q4Total+=toDigit(q4); q5Total+=toDigit(q5); q6Total+=toDigit(q 6 ); q7Total+=toDigit(q7); q8Total+=toDigit(q8); q9Total+=toDigit(q9); q10Total+= t oDigit(q10); counter++; } catch(Exception cng) { System.exit(1); } //write data to files try { output.writeInt(q1Total); output.writeInt(q2Total); output.writeInt (q3Total); output.writeInt(q4Total); output.writeInt(q5Total); output.writeInt( q 6Total); output.writeInt(q7Total); output.writeInt(q8Total); output.writeInt(q9 T otal); output.writeInt(q10Total); output.writeInt(counter); } catch(IOException wt) { System.exit(1); } } //change checkboxes to int int toDigit(Checkbox ch) { boolean state = ch.getState(); if(state) return (1); else return (0); } }