Results 1 to 6 of 6
  1. #1
    Copro is offline Member
    Join Date
    Aug 2009
    Posts
    6
    Rep Power
    0

    Default How to solve MENU OF OPERATIONS

    Please Help Me How to solve MENU OPERATION


    Java Code:
    import javax.swing.*;
    import java.text.DecimalFormat;
    public class MyMenuCS {
    	public static void main (String[] args) {
    		String ch;
    		int choice;
    		ch=JOptionPane.showInputDialog(" MENU OF OPERATIONS\n\n"+
    									   " [1] Addition\n" +
    									   " [2] Subtraction\n" +
    									   " [3] Multiplication\n" +
    									   " [4] Division\n" +
    									   " [0] Quit\n\n" +
    									   "Enter your choice: ");
    		choice= Integer.parseInt(ch);
    		switch(choice) {
    			case 1:
    				JOptionPane.showMessageDialog(null,"Addition is selected.");
    				break;
    			case 2:
    				JOptionPane.showMessageDialog(null,"Subtraction is selected.");
    				break;
    			case 3:
    				JOptionPane.showMessageDialog(null,"Multiplication is selected.");
    				break;
    			case 4:
    				JOptionPane.showMessageDialog(null,"Division is selected.");
    				break;
    			case 0:
    				break;
    			default:
    				JOptionPane.showMessageDialog(null,"ERROR: Invalid choice.","Error Message",JOptionPane.ERROR_MESSAGE);
    				break;
    						
    		}//switch
    		System.exit(0);
    	}//main
    }//class

  2. #2
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    25

    Default

    To get the best help, you should post a specific question. What problem are you having? The more information you can give us, the easier it will be for us to help you. Also, posting in the correct forum would help you too as this should probably have gone in the new to java forum.

    Best of luck!

  3. #3
    Copro is offline Member
    Join Date
    Aug 2009
    Posts
    6
    Rep Power
    0

    Default

    sorry im newbie here i dont know what is the right place to post this topic

    My question

    how to make addition,subtraction,etc.

    that can solve just like calculator please help me.

  4. #4
    dlorde is offline Senior Member
    Join Date
    Jun 2008
    Posts
    339
    Rep Power
    6

    Default

    Quote Originally Posted by Copro View Post
    My question

    how to make addition,subtraction,etc.

    that can solve just like calculator please help me.
    How to make addition, subtraction, etc., of what? All you have is a menu.

    Explain exactly what is supposed to happen when a menu item is selected.

  5. #5
    Copro is offline Member
    Join Date
    Aug 2009
    Posts
    6
    Rep Power
    0

    Default

    This is my question How to make a GUI Yes or No that will loop the program?

  6. #6
    DarrylBurke's Avatar
    DarrylBurke is offline Member
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,189
    Rep Power
    19

    Default

    Recommended reading:
    How To Ask Questions The Smart Way
    The while and do-while Statements (The Java™ Tutorials > Learning the Java Language > Language Basics)

    But. If you haven't yet learned how to write a looping construct, you have no business delving into GUIs. Go back to basics and write a few console applications first.

    db

Similar Threads

  1. operations on records into files without DB
    By visitchandu in forum New To Java
    Replies: 3
    Last Post: 06-30-2009, 04:19 PM
  2. Replies: 0
    Last Post: 07-07-2008, 04:47 PM
  3. React to menu action and checkbox menu
    By Java Tip in forum javax.swing
    Replies: 0
    Last Post: 06-27-2008, 07:50 PM
  4. Replies: 7
    Last Post: 05-09-2008, 07:54 AM
  5. String operations..
    By sireesha in forum New To Java
    Replies: 4
    Last Post: 12-14-2007, 02:04 AM

Posting Permissions

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