求JAVA程序二十四点

来源:百度知道 编辑:UC知道 时间:2024/05/23 23:04:13
从一到9输入四个数,如能算出二十四点,则输出方法,如不能,则输出不可以。谢谢,可以提供做题思想,最好源代码!
非常感谢,但是该程序为随机输出,我想要的是从键盘输入四个数字,然后计算!

public class Points24 {

public static void main(String[] args){
int [] FourNUM = {0,0,0,0};
int [] reArrange = {0,0,0,0};
int end;
int total = 0;
for(int i = 0 ; i < 4 ;i++){
FourNUM[i] = (int)Math.round(Math.random()*10);
if(FourNUM[i] == 0) {
FourNUM[i] = 10;
}
System.out.println("The " +(i+1)+ "Card Is : " + FourNUM[i]);
}
for(int I = 0; I < 4; I++){
reArrange[0] = FourNUM[I];
for(int J = 0; J < 4 ; J