Assignment #56 Fortune Cookie
Code
/// Name: Koosha Kimelman
/// Period: 7
/// Program Name: Fortune Cookie
/// File Name: FortuneCookie.java
/// Date Completed: 11/5/15
import java.util.Random;
public class FortuneCookie {
public static void main(String[] args) {
Random r = new Random();
int fortune = 1+r.nextInt(6);
if (fortune == 1)
System.out.println("Fortune cookie says: \"Go get a real fortune cookie.\"");
else if (fortune == 2)
System.out.println("Fortune cookie says: \"Give me full credit for these excellent fortunes.\"");
else if (fortune == 3)
System.out.println("Fortune cookie says: \"Don't take any of these fortunes seriously.\"");
else if (fortune == 4)
System.out.println("Fortune cookie says: \"Try again.\"");
else if (fortune == 5)
System.out.println("Fortune cookie says: \"This was really easy to make.\"");
else if (fortune == 6)
System.out.println("Fortune cookie says: \"I can't think of a sixth fortune, just make something up.\"");
System.out.println();
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