java 猜拳小游戏(2)

来源:互联网 发布:阿里云openstack架构 编辑:程序博客网 时间:2024/04/28 10:11
/** * 机器人 *  * @author  *  */public class computer {String name;int score;public int showflst() {int flag = (int) (Math.random() * 3 + 1);switch (flag) {case 1:System.out.println("电脑出拳:剪刀");break;case 2:System.out.println("电脑出拳:石头");break;case 3:System.out.println("电脑出拳:布");break;}return flag;}}