Assignment #56 and Fortune Cookie
Code
/// Name: Graham Pollock
/// Period: 5
/// Program Name: Fortune Cookie
/// File Name: FortuneCookie.java
/// Date Finished: 12/01/2015/
import java.util.Random;
public class FortuneCookie
{
public static void main (String[] args)
{
Random r = new Random();
int words = 1 + r.nextInt(6);
int n1 = 1 + r.nextInt(54);
int n2 = 1 + r.nextInt(54);
int n3 = 1 + r.nextInt(54);
int n4 = 1 + r.nextInt(54);
int n5 = 1 + r.nextInt(54);
int n6 = 1 + r.nextInt(54);
if (words == 1)
{
System.out.println("If you have something good in your life, don't let it go!");
System.out.println(" " + n1 + " - " + n2 + " - " + n3 + " - " + n4 + " - " + n5 + " - " + n6 );
}
else if (words == 2)
{
System.out.println("You cannot love life until you live the life you love.");
System.out.println(" " + n1 + " - " + n2 + " - " + n3 + " - " + n4 + " - " + n5 + " - " + n6 );
}
else if (words == 3)
{
System.out.println("A dream you have will come true.");
System.out.println(" " + n1 + " - " + n2 + " - " + n3 + " - " + n4 + " - " + n5 + " - " + n6 );
}
else if (words == 4)
{
System.out.println("A very attractive person has a message for you.");
System.out.println(" " + n1 + " - " + n2 + " - " + n3 + " - " + n4 + " - " + n5 + " - " + n6 );
}
else if (words == 5)
{
System.out.println("The greatest risk is not taking one.");
System.out.println(" " + n1 + " - " + n2 + " - " + n3 + " - " + n4 + " - " + n5 + " - " + n6 );
}
else if (words == 6)
{
System.out.println("Now is the time to try something new.");
System.out.println(" " + n1 + " - " + n2 + " - " + n3 + " - " + n4 + " - " + n5 + " - " + n6 );
}
}
}
Picture of the output