Assignment #56
Code
///jack newsom
///period 5
///program name FortuneCookie
///filename FortuneCookie.java
///date completed 10/6/15
import java.util.Random;
public class FortuneCookie
{
public static void main( String[] args )
{
Random r = new Random();
int fNum = r.nextInt(5);
int l1 = r.nextInt(54) + 1;
int l2 = r.nextInt(54) + 1;
int l3 = r.nextInt(54) + 1;
int l4 = r.nextInt(54) + 1;
int l5 = r.nextInt(54) + 1;
int l6 = r.nextInt(54) + 1;
if ( fNum == 0 )
System.out.println("Something you lost will soon turn up.");
else if ( fNum == 1 )
System.out.println("Fame and fortune will soon be yours.");
else if ( fNum == 2 )
System.out.println("You will be invited to an exciting event.");
else if ( fNum == 3 )
System.out.println("Reality is wrong, dreams are for real.");
else if ( fNum == 4 )
System.out.println("The one you love is closer than you think.");
else
System.out.println("Better to press shirt than to press luck.");
System.out.println( l1 + " - " + l2 + " - " + l3 + " - " + l4 + " - " + l5 + " - " + l6 );
}
}
Picture of the output