/** * FILE: BetterGuy.java * AUTHOR: Ivan J Leichtling * INTERNET: ivan@columbia.edu * * This file has a small list of things for a woman to say when she decides to * ditch her old fiancee. */ import java.util.*; public class BetterGuy { static Random rand = null; // redefine to add more elements to the switch private static final int SWITCHSIZE = 7; String s; public BetterGuy( String woman, String newMan, String oldMan ) { if( null == rand ) { rand = new Random(); } switch( Math.abs( rand.nextInt() % SWITCHSIZE ) ) { case 0: s = "\"Oh, " + newMan + ", I like you so much better than\nmy fiancee, " + oldMan + "\", " + woman + " coos."; break; case 1: s = woman + " bats her eyes and says, \"" + newMan + " you are\njust so" + " clever.\""; break; case 2: s = woman + " has been seen all over town with " + newMan + "!\nWhat " + "will " + oldMan + " think?"; break; case 3: s = "\"" + newMan + ", you are stealing my heart away from\n" + oldMan + "!\", cries " + woman + "."; break; case 4: s = "\"" + newMan + " is so keen!\" thinks " + woman + ".\n\"Perhaps I " + "decided on " + oldMan + " a bit prematurely.\""; break; case 5: s = "\"" + oldMan + " just can\'t compare with " + newMan + "\", " + "thinks " + woman + "."; break; default: s = "\"" + newMan + ",\" confides " + woman + "\" I have never felt\n" + "this way about anyone - not even my fiancee, " + oldMan + "!\""; break; } } public String toString() { return s; } }