Dont know where to even start

Well I really need som help on where to even start this program? I'd send u what i have so far but its so full of errors i'd be embarsed. I'll prob need to just start a new and was wondering where the heck i should even begin:
Problem Statement: Your need to Create a public class 'MathQuiz' that extends JApplet and implements ActionListner. Basically the program is aimed at helping elementary school students learn basic math operations of addition, subtraction, multiplication, division and additionally the modulus operator.
Program first prompts user for an integer 1 to 5 to indicate choice of math operation in a JTextField as 1: for addition 2: for subtraction 3: for multiplication 4: for division (typically in java integer division) and 5: for modulus (remainder value in a division).
Use Math.random() to produce two positive integers, first integer in the range of 11 to 20 and second integer in the range of 1 to 10. Then frame a question of user's choice of operation with these two numbers and prompt user for his response to the question.
Accept user's response in a JTextField and upon click of "Enter" button evaluate user's response and display message in applet container's status bar. If the response is correct display "Very good!" and ask another question of the same math operation. If the response is wrong display" No. Please try again" on applet's status bar and let user try the same question until the user gets it right.
A separate method is to be defined to generate question that takes the argument of user's choice, generates the random numbers in required range and employing 'switch' selection structure formulates the appropriate question. This method should be called each time user changes his choice in the JTextField and each time the user answers questions correctly.
If the user enters a number other than 1 to 5 in the choice JTextField, program should display 'Invalid input" message is status bar and instead of framing a question prompt the user for only "valid" choice number.
I'm new at this so this is quite a task for me to tackle. any sugestions would be greatly appricated!
well i guess i'll give what i've got so far dont laugh to hard.
// MathQuiz.java
// math quiz
// Java core packages
import java.awt.*;
import java.awt.event.*;
// Java extension packages
import javax.swing.*;
public class MathQuiz {
public static void main( String args[] )
int choice=0;
int value;
switch (choice) {
//addition
case 1:
//subtraction
case 2:
//multiplication
case 3:
//division
case 4:
//modulus
case 5:
break;
// pick random integer between 11 and 20
value = 11 + ( int ) ( Math.random() * 10 );
System.exit ( 0 );
its a start right? any help

This is probably what you need (I hate case):
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import javax.swing.event.*;
public class MathQuiz extends JApplet implements ActionListener, DocumentListener
     JPanel      panel;
     JTextField  choice = new JTextField(2);
     int         co     = 0;
     JTextField  result = new JTextField(10);
     JLabel      num1   = new JLabel(""); 
     JLabel      num2   = new JLabel(""); 
     JLabel      op     = new JLabel(""); 
     JButton     calc   = new JButton("Enter"); 
     JLabel      status = new JLabel(""); 
public void init()
     panel = new JPanel();
     panel.setLayout(new FlowLayout(FlowLayout.LEFT,12,1));
     panel.add(new JLabel("Enter choice: "));
     panel.add(choice);
     choice.getDocument().addDocumentListener(this);
     getContentPane().add("North",panel);
     panel = new JPanel();
     panel.setLayout(new FlowLayout(FlowLayout.LEFT,12,13));
     panel.add(num1);
     panel.add(op);
     panel.add(num2);
     panel.add(calc);
     panel.add(result);
     getContentPane().add("Center",panel);
     status.setForeground(Color.red);
     status.setFont(new Font("",1,34));
     getContentPane().add("South",status);
     calc.addActionListener(this);
     calc.setFocusPainted(false);
     calc.setEnabled(false);
public void start()
     choice.requestFocus();
public void actionPerformed(ActionEvent a)
     try
          int rs = Integer.parseInt(result.getText());
          int n1 = Integer.parseInt(num1.getText());
          int n2 = Integer.parseInt(num2.getText());
                 if (checkResult(n1,n2,rs) == true)
               status.setText(" Very good !!");
               newQ();
          else status.setText(" No. Please try again");
     catch (Exception e)
          status.setText("** Illagal number entered **");
     result.requestFocus();
private boolean checkResult(int n1, int n2, int rs)
     if (co == 1 && n1+n2 == rs) return(true);
     if (co == 2 && n1-n2 == rs) return(true);
     if (co == 3 && n1*n2 == rs) return(true);
     if (co == 4 && n1/n2 == rs) return(true);
     if (co == 5 && n1%n2 == rs) return(true);
     return(false);
public void insertUpdate(DocumentEvent e)
     checkChoice();
public void removeUpdate(DocumentEvent e)
     checkChoice();
public void changedUpdate(DocumentEvent e) 
     checkChoice();
private void newQ()
     num1.setText(""+(int) ((Math.random()*10)+11));
     num2.setText(""+(int) ((Math.random()*10)+1));
     result.setText("");
private void checkChoice()
     num1.setText("");
     num2.setText("");
     result.setText("");
     calc.setEnabled(false);
     try
          co = Integer.parseInt(choice.getText());
          if (co < 1 || co > 5)
                status.setText("  Invalid input");
               co = 0;
          else
                newQ();     
               status.setText("");
               if (co == 1) op.setText("+");
               if (co == 2) op.setText("-");
               if (co == 3) op.setText("*");
               if (co == 4) op.setText("/");
               if (co == 5) op.setText("%");
               calc.setEnabled(true);
     catch (Exception e)
          status.setText("  Invalid input");
          co = 0;
}Noah

Similar Messages

Maybe you are looking for

  • Photo's only appear in iPhoto but not on my Hard drive????

    So I was trying to go throught my back ups to make sure all my photos where getting back up and I noticed all my photos from the past year are not on my Time Machine Backups, I did a little more research and I can't locate the files on my computer. H

  • Can't get ADE to recognise my kobo - help!!

    I bought a kobo aura today. Bought a book from the kobo stall which is reading fine. The main reason I got an ereader was for ebooks from the public library. So I then I tried to get a public library book on to the kobo. Successfully transferred a co

  • The new MacBook Pro 15" -- video adapters fry computer?

    So, I haven't been able to find anything on this online yet, and I could well be wrong, so proceed with care and let me know if this is debunked, and I'll edit appropriately. I was at J&R World (New York) earlier today, to buy a VGA adapter for my br

  • ATV2 won't boot

    Without warning, ATV2, after plugging in to different television, begins boot process, Apple appears onscreen, then shuts off and begins reboot, and then cycles continuously thjis way. Starts to bbot, cuts off, then tries reboot. Can't

  • Telephone number for Korea telecom freetel?

    I've discovered through AppleCare UK that my phone is locked to a Korean carrier, namely Korean Telecom Freetel Does anybody have any experience in contacting this carrier and getting their phone unlocked? Does anybody know the telephone number? Than