Assignemnt #56 Fortune Cookie
Code
Name: Iaroslav Titov
Period: 7
Project Name: FortuneCookie
File Name: FortuneCookie.java
Date: 11/9/2015
import java.util.Random;
import java.util.Scanner;
public class FortuneCookie
{
public static void main(String[] args) {
new Scanner(System.in);
Random r = new Random();
String[] FC = new String[]{"Beware of dying today.", "Do NOT divide by zero.", "You will meet love of your life.", "Run, dude, run!", "Don\'t trust fortune cookies.", "Beware chinese food."};
byte says = (byte)r.nextInt(6);
System.out.println();
System.out.println("Fortune Cookie says: " + FC[says]);
System.out.println();
for(int i = 0; i < 6; i++)
{
System.out.print(1 + r.nextInt(54) + (i < 5?" - ":""));
}
System.out.println();
}
}
Picture of the output