Assignemnt #56 and The Fortune Cookie
Code
/// Name: Kyle Ivy
/// Period: 5
/// Program Name: FortuneCookie
/// File Name: FortuneCookie.java
/// Date Finished: 12/2/2015
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 = "Flee the city you must.";
else if ( choice == 2 )
response = "In danger your life is.";
else if ( choice == 3 )
response = "Prosperous your future will be.";
else if ( choice == 4 )
response = "Betrayal by those cloest to you I see.";
else if ( choice == 5 )
response = "Romance you will find.";
else if ( choice == 6 )
response = "Cloudy your future is.";
System.out.println( "Fortune Cookie says: " + response );
System.out.println( " " + num1 + " - " + num2 + " - " + num3 + " - " + num4 + " - " + num5 + " - " + num6);
}
}
prog56.PNG