import java.util.Scanner;
public class GuessDemo {
public static void main(String[] args) {
final int price = ((int)(Math.random()*10000) % 9 + 1 )* 1000;
int guessPrice = -1;
int count = 0;
String prizeName = null ;
for (int i = 0; i < 5; i++) {
System.out.println("请输入神秘商品的单价:(" + ++count + "次)");
guessPrice = new Scanner(System.in).nextInt();
if(guessPrice == price){
if(count == 1){
System.out.println("牛逼了,一次就猜对了");
prizeName = "iphone8s plus plus 土豪金";
}else if(count >= 2 && count <= 3 ){
prizeName = "华为荣耀手环Zero";
}else {
prizeName = "小米蓝牙耳机青春版" ;
}
break;
}else if(guessPrice < price ) {
if(count == 1){
System.out.println("小了喔,不要灰心,游戏才刚刚开始!");
}else if(count >= 2 && count <= 3 ){
System.out.println("还是小了喔,在大点!");
}else if(count == 4) {
System.out.println("还是小,在大!");
}
}else if(guessPrice > price ){
if(count == 1){
System.out.println("大了喔,不要灰心,游戏才刚刚开始!");
}else if(count >= 2 && count <= 3 ){
System.out.println("还是大了喔,在小点!");
}else if(count == 4) {
System.out.println("还是大,在小!");
}
}
}
if(null == prizeName){
System.out.println("很遗憾,五次机会用完了,期待下次吧!");
}else{
System.out.println("恭喜,您中奖了,奖品是:");
System.out.println(prizeName);
}
}
}