package generate;
class StarGames{
String result="miss";
int []locationCells;
int numberhits;
public void setnumber(int[] locs) {
locationCells=locs;
}
public void Judgement(int ell) {
int numm=0;
for(int cell: locationCells) {
if(cell==ell)
{
result="hit";
numm++;
break;
}
// else
// {
// result="miss";
// }
//
if(numm==locationCells.length) {
result="kill";
}
}
System.out.print(result);
}
}
public class intergger {
public static void main(String[] args) {
// TODO Auto-generated method stub
String str="2";
int shijian=Integer.parseInt(str);
StarGames p=new StarGames();
int [] location= {2,3,4};
p.setnumber(location);
p.Judgement(shijian);
}
}
一个小游戏
最新推荐文章于 2022-05-02 01:00:18 发布