title: First C# program with two Classes. Confused
body: <p>pretty new to programming and I'm a bit stuck. This is the first program I've written with two classes (in two seperate class files). I'll include all the code below. It's a program to play a dice game called Craps. My task is too create a method in the CrapsGame class that allows me to play the game over and over again until I decide to stop. But I'm having a little trouble working out how to correctly call the manyPlay() method. I'm not really sure what I'm doing. The program will play the game once by calling myCraps.play() but then won't go any further. If anyone else notices anything wrong with the code or anything that's bad practice then please point it out as I am very keen to learn. Thanks to anyone that takes the time to answer.</p>
  
  <pre><code>using System;
  
  namespace Task4_7
  {
      public class CrapsGame
      {
          string replay;
          private Craps myCraps;
          private CrapsGame newGame;
  
  
          public static void Main()
          {
              CrapsGame newGame = new CrapsGame();
              Craps myCraps = new Craps ();
              myCraps.play ();
              newGame.manyPlay ();
          }
          public void manyPlay() {
              string input; // declare local variable
              do {
                  myCraps.play();
                  replay:
                  Console.Write("Would you like to play again? y/n");
                  input = Console.ReadLine();
                  if (input == "y") {
                      replay = input;
                  }
                  else if (input == "n") {
                      replay = "n";
                  }
                  else {
                      Console.WriteLine("\n Erroneous input. Please enter y (yes) or n (no)");
                      goto replay;
                  }
              }
              while(replay != "n");
          } 
      }
  }
  
  
  
  
  
  using System;
  
  namespace Task4_7
  {
      public class Craps
      {
          private Random randy;               // define randy as a Random class
  
          public Craps() {
  
              this.randy = new Random ();
          }
  
          public int oneThrow() {
              return randy.Next(6) + 1;        // pick a number from 1 to 6 and return this
          }
          public int throw2Dice() {
              int a, b, c;
              a = oneThrow ();
              b = oneThrow ();
              c = a + b;
              Console.WriteLine ("You threw a " + a + " and a " + b + " making " + c);
              return c;
          }
          public void play() {
              int result = throw2Dice ();
              switch (result) {
                  case 2:
                      Console.WriteLine ("You lose! End of game!");
                      break;
                  case 3:
                      Console.WriteLine ("You lose! End of game!");
                      break;
                  case 12:
                      Console.WriteLine ("You lose! End of game!");
                      break;
                  case 7:
                      Console.WriteLine ("You win! End of game!");
                      break;
                  case 11:
                      Console.WriteLine ("You win! End of game!");
                      break;
                  case 4:
                      Console.WriteLine ("Your point! Rolling again!");
                      throwPoint (result);
                      break;
                  case 5:
                      Console.WriteLine ("Your point! Rolling again!");
                      throwPoint (result);
                      break;
                  case 6:
                      Console.WriteLine ("Your point! Rolling again!");
                      throwPoint (result);
                      break;
                  case 8:
                      Console.WriteLine ("Your point! Rolling again!");
                      throwPoint (result);
                      break;
                  case 9:
                      Console.WriteLine ("Your point! Rolling again!");
                      throwPoint (result);
                      break;
                  default:
                      Console.WriteLine ("Your point! Rolling again!");
                      throwPoint (result);
                      break;
              }
          }
          public void throwPoint(int result) {
              Throw:
              int a = throw2Dice();
              if (a == result) {
                  Console.WriteLine ("You rolled the same score! You win!");
              } else if (a == 7) {
                  Console.WriteLine ("You rolled a 7! You loose!");
              } else {
                  Console.WriteLine ("You rolled a " + a + ". Rolling again!");
                  goto Throw;
              }
          }
      }
  }
  </code></pre>