Results 1 to 3 of 3
  1. #1
    Ramaan is offline Member
    Join Date
    Mar 2010
    Posts
    1
    Rep Power
    0

    Question How do i make this work What am i doing Wrong.

    import javax.swing.JOptionPane;

    public static void passOrFail{

    {
    public static void main (String[] args)

    int mark;
    String numStr;

    numStr=JOptionPane.showInputDialog("What is the Mark?:");
    mark=Integer.parseInt(numStr);

    if(mark>=40)
    JOptionPane.showMessageDialog(null, "passed");
    else
    JOptionPane.showMessageDialog(null,"failed");

    JOptionPane.showmessageDialog(null,"Bye");
    }
    }


    Im using JE creater Pro. and this was a sample question in the text book we use well they gave us this code. So im wondering how i would make it work.

    The codes suppose to
    1) get the mark from a student
    2) IF it is greater then the pass mark tell them they have passed
    ELSE
    tell them they have failed
    3) thank them for using the system.

    Passing mark being >= 40

  2. #2
    [RaIdEn] is offline Senior Member
    Join Date
    Oct 2009
    Location
    California,US
    Posts
    201
    Rep Power
    6

    Default

    Java Code:
    {
    public static void main (String[] args)
    check that line
    Last edited by [RaIdEn]; 03-01-2010 at 11:41 PM.

  3. #3
    djr1 is offline Member
    Join Date
    Feb 2010
    Posts
    5
    Rep Power
    0

    Default

    Java Code:
    JOptionPane.showmessageDialog(null,"Bye");
    And this one as well. :)

    And you need:
    Java Code:
    public class ...

Similar Threads

  1. Make the Button Work
    By ŖΫ ỏ Ңόρę in forum New To Java
    Replies: 1
    Last Post: 02-27-2010, 10:52 AM
  2. [Help] setSize work wrong ???
    By dawp in forum New To Java
    Replies: 7
    Last Post: 11-05-2009, 09:30 AM
  3. Cannot make Java6 update10 work
    By Sphacelaria in forum New To Java
    Replies: 5
    Last Post: 12-01-2008, 03:48 AM
  4. Can't make JTable work -- please help!!
    By cagalli83 in forum Advanced Java
    Replies: 0
    Last Post: 02-13-2008, 09:31 AM
  5. To make work DLL from webservices
    By Felissa in forum Advanced Java
    Replies: 1
    Last Post: 07-05-2007, 07:07 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •