title: Implementing Java code for a betting game on coin-flips
body: <p>I have looked all over this website and other websites trying to figure how to do this with the knowledge that my teacher has provided me.</p>
  
  <p>Basically the program is supposed to be a user input system where you can make bets on a head or tails coin flipping game.</p>
  
  <p>So far, I've had no luck in what to do. Not asking someone to finish it for me, but to help me in the right direction.</p>
  
  <p>Thank you in advance.</p>
  
  <p>Here is my code so far:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>package Homework6;
  
  import java.util.Scanner;
  
  import java.lang.Math;
  
  public class CoinFlip {
  
   public static void main(String[]args){
   
   Scanner input = new Scanner(System.in);
   int money = 10;
   double flip = Math.random();
   String heads = "heads";
   String tails = "tails";
   int bet = input.nextInt();
   
   while(bet &lt; 0 || bet &gt; money){
    if(true){
     System.out.println("How much do you want to bet?");
     input.next();
    }
   }
    
   System.out.println("Guess if the coin will be heads or tails.");
   String guess = input.next();
   
   String coin;
   if (flip &lt;0.5) coin = heads;
   else coin = tails;
   
   if(guess == coin){
    int correct = money + bet;
    System.out.println("The flip was"+ coin);
    System.out.println("You win" + bet);
    System.out.println("")
    }
   
   
   
   
   
   }
  } </code></pre>
  </div>
  </div>
  </p>