/** * FILE: AcceptGuy.java * AUTHOR: Ivan J Leichtling * INTERNET: ivan@columbia.edu * * This file has a small list of things for a woman to say when she accepts a * man's marraige proposal. */ import java.util.*; public class AcceptGuy { static Random rand = null; // Redefine this to add more elements to the switch below. private static final int SWITCHSIZE = 4; String s; public AcceptGuy( String woman, String man ) { if( null == rand ) { rand = new Random(); } switch( Math.abs( rand.nextInt() % SWITCHSIZE ) ) { case 0: s = "\"Oh " + man + ",\" cries " + woman + ", \" I will marry you!\""; break; case 1: s = woman + " smiles at " + man + ", \"I accept your proposal!\""; break; case 2: s = "\"MOTHER!\" screams " + woman + ", \"" + man + " and I are going to be married!\""; break; default: s = "\"I\'ve been wondering when you would ask,\" " + woman + " says to " + man + ".\n\"Of course I accept!\""; break; } } public String toString() { return s; } }