Assignemnt Final!!!!

Code

    ///Name: Morgan Kaplan
    ///Period: 5
    ///Project Name: Final
    ///File Name: Final.java


import java.util.Random;
import java.util.Scanner;

public class Final
{
	public static void main( String[] args )
	{
		Scanner keyboard = new Scanner(System.in);
		Random rng = new Random();

		int n, t=0, heads = 0, tails = 0;// I used 3 different ++ thingies to keep track of how many of which coin I had
        
        System.out.print( "How many times would you like to flip your coin? " );
			n = keyboard.nextInt();
		
        do// I used a do while loop because it's less coding
		{
            int flip = rng.nextInt(2);
			String coin;
			
            if  ( flip == 1 ){
            coin = "HEADS";
                heads++;
            }
            
            else {
                coin = "TAILS";
                tails++;
            }
		    t++;    
        }
    while (n!=t);
        System.out.println(" You rolled Heads " + heads + " times and Tails " + tails + " times.");
    
                double poh = (double)heads / n; 
                double pot = (double)tails / n; 
    System.out.println(" Your probability of heads is " + poh + " and your probabilityof tails is " + pot + "");
    
        // The bigger number the better your chances are of getting a probability of 50 50.
    }
    
} 

Picture of Output

Assignment Final