Assignemnt #56: Fortune Cookie
Code
///Name: Cassie
///Period: 6
///Program Name: Fortune Cookie
///File Name: fortunecook.java
///Date Finished: 12/3/2015
import java.util.Random;
public class fortunecook
{
public static void main ( String[] args )
{
Random r = new Random();
int choice = 1 + r.nextInt(6), num1 = 1 + r.nextInt(54), num2 = 1 + r.nextInt(54), num3 = 1 + r.nextInt(54), num4 = 1 + r.nextInt(54), num5 = 1 + r.nextInt(54), num6 = 1 + r.nextInt(54);
String response = "";
if ( choice == 1 )
response = "The end is near... and it is your fault";
else if ( choice == 2 )
response = "You will die alone and poorly dressed";
else if ( choice == 3 )
response = "Never tease an armed midget with a high five";
else if ( choice == 4 )
response = "The fortune you seek is in another cookie";
else if ( choice == 5 )
response = "Confucious say: man who fishes in other man's well offen catches crabs";
else if ( choice == 6 )
response = "A drunk mans' words are a sober mans' thoughts";
else
System.out.println( "Something lost will soon turn up" );
System.out.println( " Fortune cookie says: " + response );
System.out.println( " " + num1 + " - " + num2 + " - " + num3 + " - " + num4 + " - " + num5 + " - " + num6 + " " );
}
}
Picture of the output