Fortune Cookie
Code
/// Name: Rachel Smith
/// Period: 5
/// Program Name: Fortune Cookie
/// File Name: FortuneCookie.java
/// Date Finished: 11/9/2015
import java.util.Random;
public class FortuneCookie {
public static void main( String[] args ) {
Random r = new Random();
int fortune, n1, n2, n3, n4, n5, n6;
fortune = 1 + r.nextInt(6);
if ( fortune == 1 ) {
System.out.println( "Jack is going to ask you out soon" );
}
else if ( fortune == 2 ) {
System.out.println( "Jack would say yes if you asked him out" );
}
else if ( fortune == 3 ) {
System.out.println( "Jack would come around with time if you asked him out" );
}
else if ( fortune == 4 ) {
System.out.println( "Jack would pretend you never asked him out if you did" );
}
else if ( fortune == 5 ) {
System.out.println( "Jack would kill himself if you asked him out" );
}
else if ( fortune == 6 ) {
System.out.println( "Jack would kill you if you asked him out" );
}
else {
System.out.println( "Oops" );
}
n1 = 1 + r.nextInt(54);
n2 = 2 + r.nextInt(54);
n3 = 3 + r.nextInt(54);
n4 = 4 + r.nextInt(54);
n5 = 5 + r.nextInt(54);
n6 = 6 + r.nextInt(54);
System.out.println( "\t" + n1 + " - " + n2 + " - " + n3 + " - " + n4 + " - " + n5 + " - " + n6 );
}
}
Picture of the output