Assignment # 56 and Fortune Cookie
Code
/// Name: Tommy Oyuntseren
/// Period: 7
/// Program Name: FortuneCookie
/// File Name: FortuneCookie.java
/// Date: 12/2/2015
import java.util.Scanner;
import java.util.Random;
public class FortuneCookie
{
public static void main(String[] args)
{
new Scanner(System.in);
Random r = new Random();
String[] FC = new String[]{"You will meet the love of your life tomorrow.", "Money will come easy to you within the next few weeks.", "Be careful of zombies trying to eat you.", "You will be hungry again in an hour.", "You will go to the hospital at least twice in the next month.", "Beware indian 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