Could someone sort these errors out for me cause i ain't got a clue how to deal with them, i have narrowed it down to 7, which use to be 19, thanks for your help
public class guessnumber extends Applet implements Runnable, ActionListener { String msg; Thread t = null; int state; boolean stopflag; private Label l1, l2; private TextField t1, t2; private Button b1; private int num, mynum, diff, red, blue, green, chance = 0; private Color c;
public void init() { c = new Color( 0, 80, 0 ); setForeground( c ); l1 = new Label("I have kept a number between 1 and 1000."); l2 = new Label("Can you guess this number?"); t1 = new TextField(10); t2 = new TextField(10); b1 = new Button("Play Again"); t2.setEditable(false); add(l1); add(l2); add(t1); add(t2); add(b1);
t 1.addActionListener(this); b1.addActionListener(this); num = 1 + (int) (Math.random()*1000); }
public void start() { msg = getParameter( "Guess The Number?" ); if(msg == null) { msg = "Message not found"; } msg = " " + msg; t = new Thread( this ); stopflag = false; t.start(); }
if( ae.getSource() == b1 ) { red = 255; blue = 255; green = 255; c = new Color(red, green, blue); setBackground(c); num = 0; num = 1 + (int) (Math.random()*1000); chance = 0; showStatus( "" ); t1.setEditable(true); t2.setEditable(false); t1.setText(""); t2.setText(""); } else { mynum = Integer.parseInt(t1.getText()); chance++; if( chance == 1 ) { showStatus( chance + " chance over" ); } else { showStatus( chance + " chances over" ); } if( chance >= 9 ) { t1.setText( String.valueOf(num) ); showStatus( "Your 9 chances are up" ); t1.setEditable( false ); } diff = num - mynum; if(diff == 0) { setBackground(Color.pink); t1.setEditable(false); t2.setText("You've done it"); t2.setEditable(false); } else if(Math.abs(diff)>200) { if(diff>0) { t2.setText("Too Low"); } else { t2.setText("Too High"); } } else if(Math.abs(diff)<200) { if(diff>0) { red = 255-diff; green = 0; blue = 0; c = new Color(red, green, blue); t2.setText(""); setBackground(c); } else if(diff<0) { red = 0; green = 0; blue = 255 + diff; c = new Color(red, green, blue); t2.setText(""); setBackground(c);
if (count < 10) System.out.print ("Congrats.. you took less than 10 chances"); else if (count == 10) System.out.print ("Congrats .. you just made it"); else System.out.print ("you need practice"); { JOptionPane.showMessageDialog (null, "Illustrate the use of JOptionPane methods"); String firstName = JOptionPane.showInputDialog ("What is your first name?"); String lastName = JOptionPane.showInputDialog ("What is your last name?"); JOptionPane.showMessageDialog (null, "Reversed it is " + lastName + ", " + firstName); System.exit (0); // needed when using JOptionPane