/* File: HelloRandom.java - March 2019 */ package l04; /** * A hello world program that says "Hello World" a random number of times * using recursion. Crashes are possible but highly unlikely! The parameter * turns out to be the average number of times it will say Hello. * * Sample usage: java l04.HelloRandom 10 * * @author Michael Albert * */ public class HelloRandom{ static final Die D = new Die(); public static void main(String[] args) { helloWorld(Integer.parseInt(args[0])); } public static void helloWorld(int n) { if (Die.roll(n) == 1) { System.out.println("Goodbye"); return; } System.out.println("Hello World"); helloWorld(n); } }