BlurbGenerator - /* / Author:...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
//******************************************************************** // Author: Lewis/Loftus // // Solution to Programming Project 11.7 // // Generates random Blurbs using recursion //******************************************************************** / import java.util.Scanner; import java.util.Random; i public class BlurbGenerator { Random chooser; public BlurbGenerator() { chooser = new Random(); } //----------------------------------------------------------------- // Recursively generates a random Whoozit 'y' string. // A Whoozit 'y' string is zero or more 'y's //----------------------------------------------------------------- private String getWhoozitYs() { StringBuffer y = new StringBuffer(); boolean stop = chooser.nextBoolean(); if (!stop) y.append(getWhoozitYs()); else return y.toString(); y.append("y"); return y.toString(); } //----------------------------------------------------------------- // Generates a random Whoozit. // A Whoozit is the character 'x' followed by zero or more 'y's
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 05/17/2011 for the course COP 3530 taught by Professor Davis during the Spring '08 term at University of Florida.

Page1 / 2

BlurbGenerator - /* / Author:...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online