Assignment #56 Fortune Cookie
Code
/// Name: Lacey Reese
/// Period: 5
/// Program Name: FortuneCookie
/// File Name: FortuneCookie.java
/// Date Finished 11/25/2015
import java.util.Random;
public class FortuneCookie
{
public static void main( String[] args )
{
Random r = new Random();
int fortune, x1, x2, x3, x4, x5, x6;
fortune = 1 + r.nextInt(6);
if ( fortune == 1 )
{
System.out.println( "Tomorrow you will win the 9.5 billion lottery." );
}
else if ( fortune == 2 )
{
System.out.println( "You might have a chance in winning the lottery." );
}
else if ( fortune == 3 )
{
System.out.println( "You didn't win the lottery." );
}
else if ( fortune == 4 )
{
System.out.println( "You won the lottery but you got murdered the next day." );
}
else if ( fortune == 5 )
{
System.out.println( "You won the lottery, but robbers stole it from you." );
}
else if ( fortune == 6 )
{
System.out.println( "You won the lottery, and you spent all of it in a year." );
}
else
{
System.out.println( "blahhh" );
}
x1 = 1 + r.nextInt(54);
x2 = 2 + r.nextInt(54);
x3 = 3 + r.nextInt(54);
x4 = 4 + r.nextInt(54);
x5 = 5 + r.nextInt(54);
x6 = 6 + r.nextInt(54);
System.out.println( "\t" + x1 + " - " + x2 + " - " + x3 + " - " + x4 + " - " + x5 + " - " + x6 );
}
}
Picture of the output
//