Assignemnt #70 and Keep On Guessing


    ///Name: Daniel Tiffany-Appleton
    ///Period: 7
    ///Program Name: Flip Again
    ///Flie Name: FlipAgain
    ///Date Finished: 12/8/15
    import java.util.Random;
    import java.util.Scanner;
    public class FlipAgain
    	public static void main( String[] args )
    		Scanner keyboard = new Scanner(;
    		Random rng = new Random();
    		String again;
            //Yes the program still works, because the do while doesn't need the again defined at the begining because it checks for the escape secence at the end of the while.
                int flip = rng.nextInt(2);
    			String coin;
    			if ( flip == 1 )
    				coin = "HEADS";
    				coin = "TAILS";
    			System.out.println( "You flip a coin and it is... " + coin );
    			System.out.print( "Would you like to flip again (y/n)? " );
    			again =;
            }while ( again.equals("y") );


Picture of the output

Assignment 70