令牌“quot;}上的Java错误&引用;“预期”;{quot;

令牌“quot;}上的Java错误&引用;“预期”;{quot;,java,arrays,syntax,Java,Arrays,Syntax,因此,我正在创建一个赌博应用程序,就在我即将结束这一晚的时候,我发现在我的结束括号的底部有一个新的错误 我得到了以下错误语法错误“{,“}”预期。 我认为我的一个方法可能有问题,但所有括号似乎都放对了。很抱歉,这是200多行代码,但如果有人能指出我在哪里出错而得到这个错误,我会非常感激。我尝试过弄乱括号,但这似乎只会导致进一步的错误 import java.util.Scanner; import java.util.Random; public class Project2 { public

因此,我正在创建一个赌博应用程序,就在我即将结束这一晚的时候,我发现在我的结束括号的底部有一个新的错误

我得到了以下错误
语法错误“{,“}”预期。

我认为我的一个方法可能有问题,但所有括号似乎都放对了。很抱歉,这是200多行代码,但如果有人能指出我在哪里出错而得到这个错误,我会非常感激。我尝试过弄乱括号,但这似乎只会导致进一步的错误

import java.util.Scanner;
import java.util.Random;
public class Project2 {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
    int min = 1;
    int max = 10;
    int colmax = 2;
    double balance = 2500.0;
    double bet1 = 0;
    double bet2 = 0;
    double profit1 = (bet1 * 2) - bet1;
    double profit2 = (bet2 * 5) - bet2;

    String kBet = null;
    System.out.println("          -==-==-==-==-==-==-==-==-==-==-"          );
    System.out.println("-==-==-=={ Welcome to the Marist Casino! }==-==-==-");
    System.out.println("          -==-==-==-==-==-==-==-==-==-==-"          );

    System.out.println("(1) Red Fox Roullete");
    System.out.println("(2) Crash");
    System.out.println("(3) Blackjack");
    System.out.print("Enter the number for the game you'd like to play!: ");
        int game = input.nextInt();

if(game == 1) {
   do {
    System.out.println("---------------------------------------------");
    System.out.println("Welcome to Red Fox Roullete!");
    System.out.print("Please choose Black or Red....and a number from 1-10: ");
    String color = input.next();
    int number = input.nextInt();

    System.out.print("Your available balance is $"+balance+". How much would you like to bet on "+color+"?");
    bet1 = input.nextInt();
    balance -= bet1;
    System.out.print("Your available balance is $"+balance+". How much would you like to bet on "+number+"?");
    bet2 = input.nextInt();
    balance -= bet2;

    System.out.println("------------------------------BET INFO------------------------------------");
    System.out.println("You just bet $"+bet1+" on "+color+" and $"+bet2+" on number "+number);
    System.out.println("Spinning............");
    System.out.println("------------------------------RESULTS-------------------------------------");

    Random rouletteNum = new Random();
    int rNum = min + rouletteNum.nextInt(max);
    int rCol = min + rouletteNum.nextInt(colmax);

    if (rCol == 1) {
        System.out.println("The machine landed on Black "+rNum);
    }
    else if(rCol != 1) {
        System.out.println("The machine landed on Red "+rNum);
    }

    if(rNum == number) {
        System.out.println("Congrats, you guessed the right number! You've won $"+profit2);
            balance += (bet2 * 5);
    }
    else if(rNum != number) {
        System.out.println("Sorry!You didnt guess the right number! You've lost "+bet2);
    }

    if(rCol == 1 && color.equals("Black")) {
        System.out.println("Congrats, you guessed the right color! You've won $"+profit1);
            balance += bet1 * 2 - bet1;
    }
    else if(rCol == 2 && color.equals("Red")) {
        System.out.println("Congrats, you guessed the right color! You've won $"+profit1);
            balance += bet1 * 2 - bet1;
    }       
    if(rCol == 2 && color.equals("Black")) {
        System.out.println("Sorry, you didn't guess the right color. You've lost $"+bet1);
    }
    else if(rCol == 1 && color.equals("Red")) {
        System.out.println("Sorry, you didn't guess the right color. You've lost $"+bet1);
    }


    System.out.println("After the bet, you're updated balance is $"+balance);
    System.out.println("-----------------------------------------------------------------");
    System.out.print("Yes or No? Would you like to place another bet in Roulette?");
        kBet = input.next();
    }
   while(kBet.equals("Yes"));
     if(kBet.equals("No")) {
        System.out.println("(1) Red Fox Roullete");
        System.out.println("(2) Blackjack");
        System.out.println("(3) Crash");
        System.out.print("Enter the number for the game you'd like to play!: ");
            game = input.nextInt();
} 

    }
    //CRASH
else if (game == 2) {
    do {
         int bet = 0;
         double start = 1.00;
         double crashValue = 1.00;
         int stopGame = 1;
         double cashout = 0;
         System.out.println("-------------------CRASH GAME--------------------------");
         System.out.println("Welcome to Crash!");
         System.out.print("What number would you like to cashout at?(Ex. 1.15):");
            cashout = input.nextDouble();
         System.out.print("Your balance is $"+balance+". How much would you like to bet on this round?:");
            bet = input.nextInt();
         System.out.println("--------------------------------------------------------------------------");
         System.out.println("Round is beginning........."); 

         for(int i =0; i < stopGame; i++) {
    do {
         double crash = Math.random() * 100;
         if (crash < 95) {
             start += .01;
             System.out.printf("%.2f\n",start);
         }
         else if(crash > 95) {
                 i++;
                 crashValue = start;
                 System.out.println("----------------------------RESULTS--------------------------------");
                 System.out.print("CRASH! The game crashed at "); 
                 System.out.printf("%.2f",start);
                 System.out.println("x"); 
         }
    } 
    while(i == 0);
   }
    if(cashout < crashValue) {
        System.out.println("Congrats! You cashed out at "+cashout+" before the game crashed. You've won $"+bet*cashout);
        balance += bet * cashout;
    }
    else {
        System.out.println("Sorry! The game crashed before you could cash out. You've lost $"+bet);
        balance -= bet;
    }
    System.out.println("After your bet, you're updated balance is $"+balance);
    System.out.println("-------------------------------------------------------------------");
    System.out.print("Yes or No? Would you like to play another round of Crash?: ");
     kBet = input.next();
}  
   while(kBet.equals("Yes"));
   if(kBet.equals("No")) {
        System.out.println("(1) Red Fox Roullete");
        System.out.println("(2) Blackjack");
        System.out.println("(3) Crash");
        System.out.print("Enter the number for the game you'd like to play!: ");
            game = input.nextInt();
     }
   }
//BlackJack Game
else if(game == 3) {
    Scanner input1 = new Scanner(System.in);
    System.out.println("---------------------Black Jack--------------------------");
    System.out.println("Welcome to BlackJack!");
    System.out.println("Available balance is $"+balance);
    System.out.print("How much would you like to bet on this hand?: ");
    int bet = input.nextInt();
    balance -= bet;
    System.out.println("You just bet $"+bet+"......Dealing cards!");
    System.out.println("----------------------------------------------------------");
    String pCard1 = dealCard();
    String pCard2 = dealCard();
    int value1 = getCardValue(pCard1);
    int value2 = getCardValue(pCard2);

    System.out.println("Your hand is a "+pCard1+" and a "+pCard2);
    System.out.print("Would you like to Hit or Stand?: ");
    String HitOrStand = input.next();
    }
}
    public static String dealCard() {
    int rCard = (int)Math.random() * 14;
    switch(rCard) {
    case 1 : return "2";
    case 2 : return "3";
    case 3 : return "4";
    case 4 : return "5";
    case 5 : return "6";
    case 6 : return "7";
    case 7 : return "8";
    case 8 : return "9";
    case 9 : return "10";
    case 10 : return "Queen";
    case 11 : return "Jack";
    case 12 : return "King";
    case 13 : return "Ace";
    }
}
    public static int getCardValue(String x) {
        if(x.equals("2")) {
            return 2;
        }
        if(x.equals("3")) {
            return 3;
        }
        if(x.equals("4")) {
            return 4;
        }
        if(x.equals("5")) {
            return 5;
        }
        if(x.equals("6")) {
            return 6;
        }
        if(x.equals("7")) {
            return 7;
        }
        if(x.equals("8")) {
            return 8;
        }
        if(x.equals("9")) {
            return 9;
        }
        if(x.equals("10")) {
            return 10;
        }
        if(x.equals("Queen")) {
            return 10;
        }
        if(x.equals("Jack")) {
            return 10;
        }
        if(x.equals("King")) {
            return 10;
        }
        if(x.equals("Ace")) {
            return 11;
        }

    }
   }
 } 
}
import java.util.Scanner;
导入java.util.Random;
公共类项目2{
公共静态void main(字符串[]args){
扫描仪输入=新扫描仪(System.in);
int min=1;
int max=10;
int colmax=2;
双平衡=2500.0;
双bet1=0;
双bet2=0;
双利润1=(bet1*2)-bet1;
双利润2=(bet2*5)-bet2;
字符串kBet=null;
System.out.println(“-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-==-”;
System.out.println(“-=-=-==-={欢迎来到马里斯特赌场!}==-=-=-=-”;
System.out.println(“-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-==-”;
System.out.println(“(1)红狐轮盘赌”);
System.out.println(“(2)崩溃”);
System.out.println(“(3)二十一点”);
System.out.print(“输入您想玩的游戏的号码!:”;
int game=input.nextInt();
如果(游戏==1){
做{
System.out.println(“-------------------------------------------------------------”;
System.out.println(“欢迎来到红狐轮盘!”;
System.out.print(“请选择黑色或红色……以及1-10之间的数字:”);
String color=input.next();
int number=input.nextInt();
System.out.print(“您的可用余额为$”+余额+”。您想在“+颜色+”上下注多少?”;
bet1=input.nextInt();
平衡-=β1;
System.out.print(“您的可用余额为$”+余额+”。您想在“+数字+”上下注多少?”;
bet2=input.nextInt();
平衡-=β2;
System.out.println(“-------------------------------------BET INFO-----------------------------------------------”;
println(“您只需在“+color+”上下注$”+bet1+”,在数字“+number上下注$”+bet2+);
System.out.println(“旋转……);
System.out.println(“-------------------------------------RESULTS-----------------------------------------------------”);
随机轮盘赌=新随机();
int rNum=最小值+下一轮轮盘赌(最大值);
int rCol=min+rouletteNum.nextInt(colmax);
如果(rCol==1){
System.out.println(“机器降落在黑色上”+rNum);
}
否则如果(rCol!=1){
System.out.println(“机器落在红色上”+rNum);
}
如果(rNum==数字){
System.out.println(“恭喜,你猜对了数字!你赢了$”+profit2);
平衡+=(β2*5);
}
否则如果(rNum!=编号){
System.out.println(“对不起!你没有猜对号码!你输了”+bet2);
}
如果(rCol==1&&color.equals(“黑色”)){
System.out.println(“恭喜,你猜对了颜色!你赢了$”+profit1);
余额+=β1*2-β1;
}
否则如果(rCol==2&&color.equals(“红色”)){
System.out.println(“恭喜,你猜对了颜色!你赢了$”+profit1);
余额+=β1*2-β1;
}       
如果(rCol==2&&color.equals(“黑色”)){
System.out.println(“对不起,您没有猜到正确的颜色。您丢失了$”+bet1);
}
else如果(rCol==1&&color.equals(“红色”)){
System.out.println(“对不起,您没有猜到正确的颜色。您丢失了$”+bet1);
}
System.out.println(“下注后,更新的余额为$”+余额);
System.out.println(“-----------------------------------------------------------------------”;
System.out.print(“是或否?您想在轮盘赌中再次下注吗?”);
kBet=input.next();
}
而(kBet.equals)(Yes);;
如果(kBet.等于(“否”)){
System.out.println(“(1)红狐轮盘赌”);
System.out.println(“(2)21点”);
System.out.println(“(3)崩溃”);
System.out.print(“输入您想玩的游戏的号码!:”;
game=input.nextInt();
} 
}
//撞车
否则如果(游戏==2){
做{
int-bet=0;
双启动=1.00;
双碰撞值=1.00;
int stopGame=1;
双倍兑现=0;
System.out.println(“------------------------崩溃游戏-------------------------------”);
System.out.println(“欢迎来到崩溃!”);
System.out.print(“您想在哪个号码兑现?(例1.15):”;
cashout=input.nextDouble();
System.out.print(“您的余额为$”+余额+”。您希望在这一轮中下注多少?:”;
bet=input.nextInt();
System.out.println(“-------------------------------------------------------------------------------------”);
System.out.println(“回合开始……);
for(int i=0;i95){
i++;
crashValue=开始;
System.out.println(“-------------------------------结果----------------------------------------------------”;
System.out.print(“崩溃!游戏崩溃在”);
System.out.printf(“%.2f”,开始);
系统输出打印项次(“x”);
}
} 
而(i==0);
}
如果(兑现import java.util.Scanner;
import java.util.Random;
public class Project2 {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
    int min = 1;
    int max = 10;
    int colmax = 2;
    double balance = 2500.0;
    double bet1 = 0;
    double bet2 = 0;
    double profit1 = (bet1 * 2) - bet1;
    double profit2 = (bet2 * 5) - bet2;

    String kBet = null;
    System.out.println("          -==-==-==-==-==-==-==-==-==-==-"          );
    System.out.println("-==-==-=={ Welcome to the Marist Casino! }==-==-==-");
    System.out.println("          -==-==-==-==-==-==-==-==-==-==-"          );

    System.out.println("(1) Red Fox Roullete");
    System.out.println("(2) Crash");
    System.out.println("(3) Blackjack");
    System.out.print("Enter the number for the game you'd like to play!: ");
        int game = input.nextInt();

if(game == 1) {
   do {
    System.out.println("---------------------------------------------");
    System.out.println("Welcome to Red Fox Roullete!");
    System.out.print("Please choose Black or Red....and a number from 1-10: ");
    String color = input.next();
    int number = input.nextInt();

    System.out.print("Your available balance is $"+balance+". How much would you like to bet on "+color+"?");
    bet1 = input.nextInt();
    balance -= bet1;
    System.out.print("Your available balance is $"+balance+". How much would you like to bet on "+number+"?");
    bet2 = input.nextInt();
    balance -= bet2;

    System.out.println("------------------------------BET INFO------------------------------------");
    System.out.println("You just bet $"+bet1+" on "+color+" and $"+bet2+" on number "+number);
    System.out.println("Spinning............");
    System.out.println("------------------------------RESULTS-------------------------------------");

    Random rouletteNum = new Random();
    int rNum = min + rouletteNum.nextInt(max);
    int rCol = min + rouletteNum.nextInt(colmax);

    if (rCol == 1) {
        System.out.println("The machine landed on Black "+rNum);
    }
    else if(rCol != 1) {
        System.out.println("The machine landed on Red "+rNum);
    }

    if(rNum == number) {
        System.out.println("Congrats, you guessed the right number! You've won $"+profit2);
            balance += (bet2 * 5);
    }
    else if(rNum != number) {
        System.out.println("Sorry!You didnt guess the right number! You've lost "+bet2);
    }

    if(rCol == 1 && color.equals("Black")) {
        System.out.println("Congrats, you guessed the right color! You've won $"+profit1);
            balance += bet1 * 2 - bet1;
    }
    else if(rCol == 2 && color.equals("Red")) {
        System.out.println("Congrats, you guessed the right color! You've won $"+profit1);
            balance += bet1 * 2 - bet1;
    }       
    if(rCol == 2 && color.equals("Black")) {
        System.out.println("Sorry, you didn't guess the right color. You've lost $"+bet1);
    }
    else if(rCol == 1 && color.equals("Red")) {
        System.out.println("Sorry, you didn't guess the right color. You've lost $"+bet1);
    }


    System.out.println("After the bet, you're updated balance is $"+balance);
    System.out.println("-----------------------------------------------------------------");
    System.out.print("Yes or No? Would you like to place another bet in Roulette?");
        kBet = input.next();
    }

   while(kBet.equals("Yes"));
     if(kBet.equals("No")) {
        System.out.println("(1) Red Fox Roullete");
        System.out.println("(2) Blackjack");
        System.out.println("(3) Crash");
        System.out.print("Enter the number for the game you'd like to play!: ");
            game = input.nextInt();
} 

    }
    //CRASH
else if (game == 2) {
    do {
         int bet = 0;
         double start = 1.00;
         double crashValue = 1.00;
         int stopGame = 1;
         double cashout = 0;
         System.out.println("-------------------CRASH GAME--------------------------");
         System.out.println("Welcome to Crash!");
         System.out.print("What number would you like to cashout at?(Ex. 1.15):");
            cashout = input.nextDouble();
         System.out.print("Your balance is $"+balance+". How much would you like to bet on this round?:");
            bet = input.nextInt();
         System.out.println("--------------------------------------------------------------------------");
         System.out.println("Round is beginning........."); 

         for(int i =0; i < stopGame; i++) {
    do {
         double crash = Math.random() * 100;
         if (crash < 95) {
             start += .01;
             System.out.printf("%.2f\n",start);
         }
         else if(crash > 95) {
                 i++;
                 crashValue = start;
                 System.out.println("----------------------------RESULTS--------------------------------");
                 System.out.print("CRASH! The game crashed at "); 
                 System.out.printf("%.2f",start);
                 System.out.println("x"); 
         }
    } 
    while(i == 0);
   }
    if(cashout < crashValue) {
        System.out.println("Congrats! You cashed out at "+cashout+" before the game crashed. You've won $"+bet*cashout);
        balance += bet * cashout;
    }
    else {
        System.out.println("Sorry! The game crashed before you could cash out. You've lost $"+bet);
        balance -= bet;
    }
    System.out.println("After your bet, you're updated balance is $"+balance);
    System.out.println("-------------------------------------------------------------------");
    System.out.print("Yes or No? Would you like to play another round of Crash?: ");
     kBet = input.next();
}  
   while(kBet.equals("Yes"));
   if(kBet.equals("No")) {
        System.out.println("(1) Red Fox Roullete");
        System.out.println("(2) Blackjack");
        System.out.println("(3) Crash");
        System.out.print("Enter the number for the game you'd like to play!: ");
            game = input.nextInt();
     }
   }
//BlackJack Game
else if(game == 3) {
    Scanner input1 = new Scanner(System.in);
    System.out.println("---------------------Black Jack--------------------------");
    System.out.println("Welcome to BlackJack!");
    System.out.println("Available balance is $"+balance);
    System.out.print("How much would you like to bet on this hand?: ");
    int bet = input.nextInt();
    balance -= bet;
    System.out.println("You just bet $"+bet+"......Dealing cards!");
    System.out.println("----------------------------------------------------------");
    String pCard1 = dealCard();
    String pCard2 = dealCard();
    int value1 = getCardValue(pCard1);
    int value2 = getCardValue(pCard2);

    System.out.println("Your hand is a "+pCard1+" and a "+pCard2);
    System.out.print("Would you like to Hit or Stand?: ");
    String HitOrStand = input.next();
    }
}

    public static String dealCard() {
    int rCard = (int)Math.random() * 14;
    switch(rCard) {
    case 1 : return "2";
    case 2 : return "3";
    case 3 : return "4";
    case 4 : return "5";
    case 5 : return "6";
    case 6 : return "7";
    case 7 : return "8";
    case 8 : return "9";
    case 9 : return "10";
    case 10 : return "Queen";
    case 11 : return "Jack";
    case 12 : return "King";
    case 13 : return "Ace";
    }
        return "Unknown";
    }

    public static int getCardValue(String x) {
        if(x.equals("2")) {
            return 2;
        }
        if(x.equals("3")) {
            return 3;
        }
        if(x.equals("4")) {
            return 4;
        }
        if(x.equals("5")) {
            return 5;
        }
        if(x.equals("6")) {
            return 6;
        }
        if(x.equals("7")) {
            return 7;
        }
        if(x.equals("8")) {
            return 8;
        }
        if(x.equals("9")) {
            return 9;
        }
        if(x.equals("10")) {
            return 10;
        }
        if(x.equals("Queen")) {
            return 10;
        }
        if(x.equals("Jack")) {
            return 10;
        }
        if(x.equals("King")) {
            return 10;
        }
        if(x.equals("Ace")) {
            return 11;
        }
        return -1;
    }
}