Assignment #56
Code
///Name: Cody Swain
///Period: 6
///Project Name: WorstNumberGame
///File Name: WorstNumberGame.java
///Date: 11/9/15
import java.util.Random;
public class FortuneCookie
{
public static void main ( String[] args )
{
Random r = new Random();
int choice = 1 + r.nextInt(6);
String response = "";
int num1 = r.nextInt(54);
int num2 = r.nextInt(54);
int num3 = r.nextInt(54);
int num4 = r.nextInt(54);
int num5 = r.nextInt(54);
int num6 = r.nextInt(54);
if ( choice == 1 )
response = "Much tradgedy will hit you soon.";
else if ( choice == 2 )
response = "You may die soon.";
else if ( choice == 3 )
response = "You will live a fruitful life.";
else if ( choice == 4 )
response = "You will obtain a lot of money.";
else if ( choice == 5 )
response = "You are going to meet a friend soon.";
else if ( choice == 6 )
response = "You are going to find great happiness.";
System.out.println( "Fortune Cookie says: " + response );
System.out.println( " " + num1 + " - " + num2 + " - " + num3 + " - " + num4 + " - " + num5 + " - " + num6);
}
}
Picture of the output