Advertisement
CristianMarinTorres

Piedra , Papel o Tijera

Apr 26th, 2017
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.78 KB | None | 0 0
  1. package javaapplication1;
  2.  
  3. import java.io.IOException;
  4.  
  5. public class JavaApplication1 {
  6.  
  7.     public static int mayor(int x, int y, int z) {//parametro formal, LA FIRMA
  8.  
  9.         if (x > y && x > z) {
  10.             return x;
  11.         }
  12.  
  13.         if (y > x && y > z) {
  14.             return y;
  15.         } else {
  16.             return z;
  17.         }
  18.  
  19.     }
  20.  
  21.     static public int azar(int x, int y) {
  22.         return x + (int) (Math.random() * (y - x + 1));
  23.     }
  24.  
  25.     public static void main(String[] args) throws IOException {
  26.  
  27.         int opUsuario = U.readInt("ingrese su opcion (1) Tijera , (2) papel , (3) piedra; ");
  28.         int opComputador = azar(1, 3);
  29.  
  30.         U.println("usuario jugo : " + opUsuario);
  31.         U.println("el computador juego :" + opComputador);
  32.     }
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement