Extra Looping Problems
Home - About Us
 

 

Questions

  1. Write a Java program that simulates the flipping of a coin.  Flip the coin 1000 times.  Report how many times heads and tails occured (total number and percentage).  Here is a sample output for the program:

    	  heads: 515 (51.5%)
    	  tails: 485 (48.5%)
    
  2. Write a Java program that prints the numbers 1 to 15.  Print an asterik ('*') next to every third number:

    	  1 *
    	  2
    	  3
    	  4 *
    	  5
    	  6
    	  7 *
    	  8
    	  9
    	  10 *
    	  11
    	  12
    	  13 *
    	  14
    	  15
  3. Write a Java program that prints five random numbers to the screen (in the range of 1 to 200).  Print an 'e' next to even numbers, and 'h' next to any value of 100 or more.

    	  82 e
    	  15
    	  3
    	  120 eh
    	  97
    	  157 h
Home - About Us
Copyright © 2006 by Kiowok, Ann Arbor, Michigan, USA