Assignment 56: Fortune Cookie
Code
/// Name: Ryan McAteer
/// Period: 5
/// Program Name: Fortune Cookie
/// File Name: Assignment56.java
/// Date Finished: 11/13/15
import java.util.Random;
public class Assignment56
{
public static void main ( String[] args )
{
Random r = new Random();
int fortune = 1 + r.nextInt(6);
if ( fortune == 1 )
System.out.println("May Fortune Come to You");
else if ( fortune == 2 )
System.out.println("I hope you like Chinese food");
else if ( fortune == 3 )
System.out.println("I was invented in San Francisco");
else if ( fortune == 4 )
System.out.println("You will recieve a positive note");
else if ( fortune == 5 )
System.out.println("Study for your next test. It will pay off");
else if ( fortune == 6 )
System.out.println("Get a haircut soon");
System.out.print( "\t" + 1 + r.nextInt(54) );
System.out.print( " - " + 1 + r.nextInt(54) );
System.out.print( " - " + 1 + r.nextInt(54) );
System.out.print( " - " + 1 + r.nextInt(54) );
System.out.println( " - " + 1 + r.nextInt(54) );
}
}
Picture of the output