Assignment #56 and Fortune Cookie
Code
/// Name: Tim Chuang
/// Period: 7
/// Program Name: Fortune Cookie
/// File Name: FortuneCookie.java
/// Date Finished: 12/4/2015
import java.util.Random;
public class FortuneCookie
{
public static void main ( String[] args )
{
Random r = new Random();
int fortune = 1 + r.nextInt(6);
if ( fortune == 1 )
System.out.println("Gud fortune 5 u");
else if ( fortune == 2 )
System.out.println("U have all the lucks");
else if ( fortune == 3 )
System.out.println("Many monies come to yu");
else if ( fortune == 4 )
System.out.println("You'll have a long happy life");
else if ( fortune == 5 )
System.out.println("U will b rich");
else if ( fortune == 6 )
System.out.println("Im actually american");
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.println( " - " + 1 + r.nextInt(54) );
}
}
Picture of the output