Choose fruit types, and each can only choose a;
Bet to your choice of fruit;
Different fruit reward;
Each initial players give 10 gold;
After operation, if stopped on the fruit of your choice,
You are rewarded, or loss of gold
Awards for: the deposit money multiplied by the coefficient of reward, each fruit coefficient of different reward, the reward coefficient as follows,
Guess the items and the corresponding incentive coefficient is as follows:
Apple 2 papaya 5 watermelon 10 bananas oranges 50 grape 100 20
CodePudding user response:
Pray god blessCodePudding user response:
JavaEE?CodePudding user response:
Package com. The test;import java.util.Random;
import java.util.Scanner;
Public class User {
//set the member variable initial value
Static int "=10;
Public static void main (String [] args) {
//create a Scanner object
Scanner sc=new Scanner(System.in);
//to select bet
for (int i=0; true; I++) {
//determine user gold
If (coin==0) {
System. Out.println (" you don't have enough gold COINS in, game over!" );
break;
}
System. The out. Println (" apple * 2 papaya * 5 * 10 * 20 banana watermelon orange * 50 * 100 grape ");
//receive user betting information
System. The out. Println (" please choose the kind of fruit ");
String fruit=sc. Next ();
System. The out. Println (" please enter the amount bet on gold: ");
Int z=0;
For (int j=0; true; J++) {
Z=sc. NextInt ();
//determine whether bet amount is greater than the account balance
If (yz> Coin) {
System. Out.println (" balance is insufficient, please input again!" );
} else {
break;
}
}
//matching fruit can generate random Numbers 1-187
Int num=new Random (). NextInt (186) + 1;
//winning determine
If (num<=100 & amp; & Fruit. Equals (" apple ")) {
Z=z * 2;
"=" + z;
System. Out.println (" winning! Earn bonuses "+ z +" balance is: "+");
} else if (num> 100 & amp; & Num<=150 & amp; & Papaya fruit. Equals (" ")) {
Z=z * 5;
"=" + z;
System. Out.println (" winning! Earn bonuses "+ z +" balance is: "+");
} else if (num> 150 & amp; & Num<=170 & amp; & Fruit. Equals (" watermelon ")) {
Z=z * 10;
"=" + z;
System. Out.println (" winning! Earn bonuses "+ z +" balance is: "+");
} else if (num> 170 & amp; & Num<=180 & amp; & Fruit. Equals (" banana ")) {
Z=z * 20;
"=" + z;
System. Out.println (" winning! Earn bonuses "+ z +" balance is: "+");
} else if (num> 180 & amp; & Num<=185 & amp; & Fruit. Equals (" orange ")) {
Z=z * 50;
"=" + z;
System. Out.println (" winning! Earn bonuses "+ z +" balance is: "+");
} else if (num> 185 & amp; & Num<=187 & amp; & Fruit. Equals (" grape ")) {
Z=z * 100;
"=" + z;
System. Out.println (" winning! Earn bonuses "+ z +" balance is: "+");
} else {
"=" - yz.
System. The out. Println (" for next time, it's a pity that the current balance: "+");
}
}
}
}
CodePudding user response:
This can be?CodePudding user response:
And Java se there is no difference in grammar!CodePudding user response: