日期:2014-05-20  浏览次数:20681 次

谁来帮我看下这个程序.为什么运行不出来.编译也有错误.
//   Application   to   test   class   Craps.
 
public   class   CrapsTest  
{
      public   static   void   main(   String   args[]   )
      {
            Craps   game   =   new   Craps();
            game.play();   //   play   one   game   of   craps
      }   //   end   main
}   //   end   class   CrapsTest

//   Craps   class   simulates   the   dice   game   craps.
import   java.util.Random;
 
public   class   Craps
{
      //   create   random   number   generator   for   use   in   method   rollDice
      private   Random   randomNumbers   =   new   Random();  
 
      //   enumeration   with   constants   that   represent   the   game   status
      private   enum   Status   {   CONTINUE,   WON,   LOST   };
 
      //   constants   that   represent   common   rolls   of   the   dice
      private   final   static   int   SNAKE_EYES   =   2;
      private   final   static   int   TREY   =   3;
      private   final   static   int   SEVEN   =   7;
      private   final   static   int   YO_LEVEN   =   11;
      private   final   static   int   BOX_CARS   =   12;
 
      //   plays   one   game   of   craps
      public   void   play()
      {
            int   myPoint   =   0;   //   point   if   no   win   or   loss   on   first   roll
            Status   gameStatus;   //   can   contain   CONTINUE,   WON   or   LOST
 
            int   sumOfDice   =   rollDice();   //   first   roll   of   the   dice
 
            //   determine   game   status   and   point   based   on   first   roll  
            switch   (   sumOfDice   )  
            {
                  case   SEVEN:   //   win   with   7   on   first   roll
                  case   YO_LEVEN:   //   win   with   11   on   first   roll                      
                        gameStatus   =   Status.WON;
                        break;
                  case   SNAKE_EYES:   //   lose   with   2   on   first   roll