Assignment #56
Code
/// Name: Jonathan Stine
/// Period: 5
/// Program Name: Fortune Cookie
/// File Name: FortuneCookie.java
/// Date Finished: 1/19/16
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( "Don't go outside." );
}
else if ( fortune == 2 ) {
System.out.println( "You are hideous, I recommend cosmetic surgery" );
}
else if ( fortune == 3 ) {
System.out.println( "You will win 1,000,000 Rupees in the Indian lottery!" );
}
else if ( fortune == 4 ) {
System.out.println( "You have second left to live. LOOK OUT BEHIND YOU!!!" );
}
else if ( fortune == 5 ) {
System.out.println( "Made in China" );
}
else if ( fortune == 6 ) {
System.out.println( "Don't eat granola in the next week, it might be poisonous." );
}
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 );
}
}
Code Output