/** * FILE: Proposals.java * AUTHOR: Ivan J Leichtling * INERNET: ivan@columbia.edu * * This file defines a a set of things for a man to say to a woman when he * proposes. */ import java.util.*; public class Proposal { static Random rand = null; // redefine to add more sayings. private static final int SWITCHSIZE = 4; String s; public Proposal( String woman, String man ) { if( null == rand ) { rand = new Random(); } switch( Math.abs( rand.nextInt() % SWITCHSIZE ) ) { case 0: s = "\"" + woman + ",\" says " + man + ", \"I have to ask\nWill you marry me?\""; break; case 1: s = "\"Baby, we belong together,\" " + man + " tells " + woman + "\n" + "\"Will you marry me?\""; break; case 2: s = man + " slides a ring onto " + woman + "\'s finger.\n\"Will you marry me?\""; break; default: s = "His eyes filled with passion, " + man + " asks,\n\"" + woman + ", will you marry me?\""; break; } } public String toString() { return s; } }