public class CoinFlip {
public static void main(String[] args) {
//Get a random number
//Decide the outcome of the coin flip
//Get a second random number
//Decide the outcome of a second coin flip
//Print out which flip had a higher score
//Print out the maximum of the two flips
double myNumber;
myNumber = Math.random();
int score;
if (myNumber < .4) {
System.out.println("heads");
score = 5;
}
else if (myNumber <.8) {
System.out.println("tails");
score = 2;
}
else if (myNumber <.85) {
System.out.println("derr");
score = 20;
}
else {
System.out.println("go 2 sleep");
score = -3;
}
System.out.println("arrgh the score for der flip wus: " + score);
}
public static int max(int a, int b);
int a = score;
int b = secondScore;
int maxScore = Math.max(score, secondScore);
System.out.println(score, secondScore);
{
}
Я получаю ожидаемую ошибку от int a и int b. Это отступы? Я не уверен, что делать. Я попытался передвигаться по отступу и скобкам безрезультатно. Я новичок в этом, и я в тупике. Я чувствую, что это очень простая проблема.<identifier> ожидается - отступы?
В вашем методе 'max', где вы определяете переменные' score' и 'secondScore'? – azurefrog
Вы не можете назвать локальные переменные именами параметров. Голосование закрывается как тривиальная проблема синтаксиса. – dasblinkenlight
Int a и int b part. Я не уверен, что это правда. – Adam