Assignemnt #56: Fortune Cookie Number Generator
Code
/// Name: Sean Harrison
/// Period: 7
/// Program name: Fortune Cookie sim
/// File Name: FortuneCookie.java
/// Date Finished: 11/13/2015
import java.util.Random;
public class FortuneCookie
{
public static void main( String [] args )
{
Random r = new Random();
int x = 1 + r.nextInt(6);
if ( x == 1 )
{
System.out.println( "Work hard for a better tomorrow " );
}
if ( x == 2)
{
System.out.println ( "Determination is the driving force of sucess " );
}
if ( x == 3 )
{
System.out.println ( "Respect one's elders " );
}
if ( x == 4 )
{
System.out.println( "Always remain vigilant in times of uncertainty");
}
if ( x == 5 )
{
System.out.println( "Be careful of offers that sound too fortunate to be true " );
}
if ( x == 6 )
{
System.out.println( "Whatever you wanted to start tomorrow, can be started today " );
}
System.out.println();
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.print( 1 + r.nextInt(54) + " - " );
System.out.print( 1 + r.nextInt(54) + " - " );
}
}
Picture of the output