Created
May 26, 2012 18:24
-
-
Save godie007/2794857 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package Trabajo; | |
import javax.swing.JOptionPane; | |
//Main | |
public class Proyecto { | |
public static void main(String[] args) { | |
int operacion = Integer.parseInt(JOptionPane.showInputDialog("Ingrese una opcion \n" | |
+ "1-Suma \n" | |
+ "2-Resta \n" | |
+ "3-Multiplicacion")); | |
operacionInicio(operacion); | |
} | |
//************************************************************************************************** | |
// metodo para sumar resta o multiplicar | |
public static void operacionInicio(int operacion) { | |
if (operacion >= 1 && operacion <= 3) { | |
int a = Integer.parseInt(JOptionPane.showInputDialog("A")); | |
int b = Integer.parseInt(JOptionPane.showInputDialog("B")); | |
switch (operacion) { | |
case 1: { | |
System.out.println("Suma: " + (a + b)); | |
break; | |
} | |
case 2: { | |
System.out.println("Resta: " + (a - b)); | |
break; | |
} | |
case 3: { | |
System.out.println("multiplicacion: " + (a * b)); | |
break; | |
} | |
} | |
}else { | |
JOptionPane.showMessageDialog(null, "Rango Invalido", | |
"Error!", JOptionPane.ERROR_MESSAGE); | |
} | |
} | |
//******************************************************************************************* | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment