Assignemnt #56 and Fortune Cookie
Code
/// Name: Brian Phillips
/// Period: 5
/// Program name: Fortune Cookie
/// File Name: FortuneCookie.java
/// Date Finished: 12/4/2015
import java.util.Random;
public class FortuneCookie
{
public static void main ( String[] args )
{
Random r = new Random();
int choice = 1 + r.nextInt(5);
String response = "";
if ( choice == 1 )
response = "You will make big money.";
else if ( choice == 2 )
response = "You will do well if you try hard... It's true.";
else if ( choice == 3 )
response = "Happiness will be found alone in your room.";
else if ( choice == 4 )
response = "These numbers might help you win the lottery.";
else if ( choice == 5 )
response = "Just enjoy the cookie no fortune here.";
System.out.println("Fortune Cookie says: " + response +"");
System.out.print( 1 + r.nextInt(54) + " " );
System.out.print("- ");
System.out.print( 1 + r.nextInt(54) + " " );
System.out.print("- ");
System.out.print( 1 + r.nextInt(54) + " " );
System.out.print("- ");
System.out.print( 1 + r.nextInt(54) + " " );
System.out.print("- ");
System.out.print( 1 + r.nextInt(54) + " " );
System.out.print("- ");
System.out.println( 1 + r.nextInt(54) + " " );
}
}
Picture of the output