Coin flipping: with symmetrical patterns of graphics - For Wednesday 09/18/2002



  1. Be sure to try the reset button a few different times.

  2. The following statements set the font to a non-proportional or fixed-width or monospaced font called Courier New. That may have caused the Applet to take a little longer to fully load into your browser.
           headsReport.setFont("Courier New");
           tailsReport.setFont("Courier New");
           missdReport.setFont("Courier New");
    
  3. This program now uses the following pattern:
          if ( coin.contains(point) )
          {
             DO THE COIN FLIPPING ACTIONS
          }
          else if ( resetButton.contains( point ) )
          {
             DO THE RESET BUTTON ACTIONS 
             Set all the counters back to 0, and the reported counts 
                should also be set to 0.
             Do the beautiful and surprising graphics pattern, continuing
                where you left off last time the user did RESET action.
          }
          else 
          {
             DO THE MISS ACTION... 
             The user did NOT click on the coin and did NOT click on the reset.
                                           ----                          -----
             missdCount = missdCount + 1;
             missdReport.setText("Missed:  " + missdCount);
          }
    
    
        Guess what this pattern matches?
    
        It chooses one of three sets of actions, right?
                          -----
     
        if ( A or condition #1 )
        {
           A. #1 situation processing...
        }
        else if ( B or condition #2 )
        {
           B. #2 situation processing...
        }
        else   // C or condition #3 by default, no if (  ) needed..
        {
           C. #3 situation processing...
        }
    
        What does this remind you of?    Three colors?  Color.black
                                                        Color.red
                                                        Color.white
        Sounds like something that applies to the 
        laundry piles and dirty laundry sorting problem to me.
    
        The color of the clothing item is either 1 or 2 or 3,
        is either black or red or white, right?