package java_人机猜拳001;
import java.util.Scanner;
public class User {
static String userName;
static int userIntegral;
public void setUserName (String userName) {
this.userName = userName;
}
public String getUserName() {
return userName;
}
public void setUserIntegral (int userIntegral) {
this.userIntegral = userIntegral;
}
public int getUserIntegral( ) {
return userIntegral;
}
public int userHand () {
Scanner sc = new Scanner(System.in);
System.out.println("输出你的猜拳:");
int guess = sc.nextInt();
switch(guess) {
case 1:
System.out.println("您出的是剪刀!");
break;
case 2:
System.out.println("您出的是石头!");
break;
case 3:
System.out.println("您出的是布!");
break;
default:
System.out.println("输入有误!");
break;
}
return guess;
}
}
原文地址:https://www.cnblogs.com/lipeitong/p/11066015.html