Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class Prueb{
- public static void main(String args[]){
- int opc=0,n1=0,n2=0;
- Calculadora p=new Calculadora();
- Scanner entrada=new Scanner(System.in);
- System.out.println("Ingrese el primer numero: ");
- n1=entrada.nextInt();
- System.out.println("Ingrese el segundo numero: ");
- n2=entrada.nextInt();
- System.out.println("Ingrese una opcion: 1) Sumar 2) Restar ");
- opc=entrada.nextInt();
- switch(opc){
- case 1: p.sumar(n1,n2);
- break;
- case 2: p.restar(n1,n2);
- break;
- default: System.out.println("Error");
- break;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment