Assignemnt #56 and Fortune Cookie
Code
/// Name: Raff Lisbona
/// Period: 6
/// Program Name: Fortune Cookie
/// File Name: FortuneCookie.java
/// Date Finished: 11/16/2015
import java.util.Random;
public class FortuneCookie
{
public static void main( String[] args )
{
Random r = new Random();
int fortune = 1 + r.nextInt(6);
String cookie = "";
if ( fortune == 1 )
cookie = "You'll make millions.";
else if ( fortune == 2 )
cookie = "Stick with your wife.";
else if ( fortune == 3 )
cookie = "Today will be a good day.";
else if ( fortune == 4 )
cookie = "This year will be a good one.";
else if ( fortune == 5 )
cookie = "Don't go outside today.";
else if ( fortune == 6 )
cookie = "Feliz Compleanos!";
System.out.println("Fortune cookie says: \"" + cookie + "\"");
System.out.print("\t" + (1 + r.nextInt(54)) + " - ");
System.out.print( 1 + r.nextInt(54) + " - ");
System.out.print( 1 + r.nextInt(54) + " - ");
System.out.print( 1 + r.nextInt(54) + " - ");
System.out.print( 1 + r.nextInt(54) + " - ");
System.out.println( 1 + r.nextInt(54) );
}
}
Picture of the output