.写一个Java应用程序,实现下列功能:
随机数生成函数: int x=(int)(Math.random()*100);
import java.util.*;
public class H4{
public static void main(String[] args){
int num=(int)(Math.random()*100+1);
Scanner sc=new Scanner(System.in);
boolean game=true;
while(game){
int a=sc.nextInt();
if(a==num){
System.out.println("猜对了");
game=false;
}else if(a>num){
System.out.println("猜大了");
}else{
System.out.println("猜小了");
}
}
}
}