import java.util.Scanner; public class Esercizio5if { public static void main(String[] args) { // Uso queste variabili in modo da non dover ripetere queste // scritte tutte le volte. final String VINCE = "Vince giocatore"; final String PARI = "Pari"; final String F_VS_C = "forbice taglia carta"; final String S_VS_F = "sasso spessa forbici"; final String C_VS_S = "carta avvolge sasso"; Scanner tastiera = new Scanner(System.in); System.out.print("Inserire mossa del giocatore 1: "); String g1 = tastiera.next().toLowerCase(); System.out.print("Inserire mossa del giocatore 2: "); String g2 = tastiera.next().toLowerCase(); if (g1.equals("c")) { if (g2.equals("c")) System.out.println(PARI); else if (g2.equals("f")) System.out.println(VINCE + " 2: " + F_VS_C); else System.out.println(VINCE + " 1: " + C_VS_S); } else if (g1.equals("f")) { if (g2.equals("c")) System.out.println(VINCE + " 1: " + F_VS_C); else if (g2.equals("f")) System.out.println(PARI); else System.out.println(VINCE + " 2: " + S_VS_F); } else { if (g2.equals("c")) System.out.println(VINCE + " 2: " + C_VS_S); else if (g2.equals("f")) System.out.println(VINCE + " 1 " + S_VS_F); else System.out.println(PARI); } tastiera.close(); } }