java人机猜拳游戏001computer
作者:互联网
package java_人机猜拳001;
import java.util.Scanner;
public class Computer {
public static String computerName;
public static int computerIntegral;
public void setCompputerName (String computerName) {
this.computerName = computerName;
}
public String getComeputerName() {
return computerName;
}
public void setComputerIntegral(int computerIntegral) {
this.computerIntegral = computerIntegral;
}
public int getComeputerIntegral() {
return computerIntegral;
}
public int computerHand() {
Scanner sc = new Scanner(System.in);
System.out.println( computerName +"猜拳!");
int radom = (int)(Math.random()*3+1);
switch(radom) {
case 1 :
System.out.println("剪刀");
break;
case 2 :
System.out.println("石头");
break;
case 3 :
System.out.println("布");
break;
default:
System.out.println("错误!");
break;
}
return radom;
}
}
标签:computerName,java,猜拳,int,computerIntegral,System,001computer,println,public 来源: https://www.cnblogs.com/lipeitong/p/11066008.html