Code
/// Name: Afaf Nabeeha
/// Period: 7
/// Program Name: Fortune Cookie
/// File Name: Cookie.java
/// Date Finished: 11/25/2015 public class Cookie
import java.util.Random;
public class Cookie
{
public static void main( String[] args )
{
Random R = new Random();
int fNumber;
fNumber = 1 + R.nextInt(6);
if ( fNumber == 1 )
{
System.out.println( "You will win the lottery." );
}
else if ( fNumber == 2 )
{
System.out.println ("The fortune you seek is in another cookie." );
}
else if ( fNumber == 3 )
{
System.out.println ("You will be hungry again in one hour." );
}
else if ( fNumber == 4 )
{
System.out.println ("Put me down and run to the gym." );
}
else if ( fNumber == 5 )
{
System.out.println ("May you have a good appetite." );
}
else if ( fNumber == 6 )
{
System.out.println ("Stop procrastinating. Starting tomorrow." );
}
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