Assignemnt #56: Fortune Cookie
Code
/// Name: Kelsey Lieberman
/// Period 5
/// Program Name: FortuneCookie
/// File Name: FortuneCookie.java
/// Date Finished: 12/3/2015
import java.util.Random;
public class FortuneCookie
{
public static void main(String[] args)
{
Random r = new Random();
int x = 1 + r.nextInt(6);
System.out.print("Fortune cookie says: ");
if (x == 1)
System.out.println("\"something great is coming your way.\"");
if (x == 2)
System.out.println("\"go the long way home tonight\"");
if (x == 3)
System.out.println("\"you will be successful if you follow your dreams\"");
if (x == 4)
System.out.println("\"the end is near\"");
if (x == 5)
System.out.println("\"expand your character\"");
if (x == 6)
System.out.println("\"remember to see the big picture and focus on what is truly important\"");
System.out.println((1 + r.nextInt(54)) + " - " + (1 + r.nextInt(54)) + " - " + (1 + r.nextInt(54)) + " - " + (1 + r.nextInt(54)) + " - " + (1 + r.nextInt(54)) + " - " + (1 + r.nextInt(54)));
}
}
Picture of the output