/** program to demonstrate the use of the switch statement
 *  Creates random fortunes constructed from nouns and adjectives
 */
class FortuneCookie {
  public static void main(String [] args) {
    final int NBR_POSS = 5; // possible number of adjectives and nouns
    final String adj1 = "very hot";
    final String adj2 = "very cool";
    final String adj3 = "truly ugly";
    final String adj4 = "small";
    final String adj5 = "most excellent";
    
    final String noun1 = "dog";
    final String noun2 = "car";
    final String noun3 = "mother-in-law";
    final String noun4 = "pair of pants";
    final String noun5 = "haircut";
    
    int selection = (int)(Math.random() * NBR_POSS) + 1; // what did we do here?
    String word = "";
    switch (selection) 
    {
      case 1: word = adj1;
              break;
      case 2: word = adj2;
              break;
      case 3: word = adj3;
              break;
      case 4: word = adj4;
              break;
      case 5: word = adj5;
              break;
      default:word = "absolutely perfect";      
      
    }
    /** Using the switch statement get the adjective for the fortune cookie
     switch (<variable>) 
     {
     case <case1>: <action performed>; // where <variable> == <case>
                   break;               // if you don't break, will continue evaluating
     case <case2>: <action performed>;
                   break;
     default:      <default action to perform if no equalities in case statements are matched>;
                   break; // if there is no default and nothing matches, nothing happens.
     }
     */
    String fortune = "You will have a " + word;
    selection = (int)(Math.random() * NBR_POSS) + 1; // what did we do here?
    word = "";
    switch (selection) 
      
    {
      case 1: word = noun1;
      break;
      case 2: word = noun2;
      break;
      case 3: word = noun3;
      break;
      case 4: word = noun4;
      break;
      case 5: word = noun5;
      break;
      default:word = "tricycle";      
      break;
    }
    /** Using the switch statement get the predicate (noun) for the fortune cookie
     switch (<variable>) 
     {
     case <case1>: <action performed>; // where <variable> == <case>
                  break;               // if you don't break, will continue evaluating
     case <case2>: <action performed>;
                  break;
     default:      <default action to perform if no equalities in case statements are matched>;
                   break; // if there is no default and nothing matches, nothing happens.
     }
     */
    System.out.println(fortune + " " + word + "!! Thank you for using our fortune cookie :)");         
  }    
}