Assignment #56 and Fortune Cookie
Code
/// Name: Lauren Baird
/// Period: 7
/// Program Name: Fortune Cookie
/// File Name: FortuneCookie.java
/// Date Finished: 10/30/2015
import java.util.Random;
public class FortuneCookie
{
public static void main( String[] args )
{
Random r = new Random();
int fortune = 1 + r.nextInt(6);
String outcome = "";
int cookie1 = 1 + r.nextInt(54);
int cookie2 = 1 + r.nextInt(54);
int cookie3 = 1 + r.nextInt(54);
int cookie4 = 1 + r.nextInt(54);
int cookie5 = 1 + r.nextInt(54);
int cookie6 = 1 + r.nextInt(54);
System.out.println();
if ( fortune == 1 )
outcome = "\"Have a great day\"";
else if ( fortune == 2 )
outcome = "\"Be kind\"";
else if ( fortune == 3 )
outcome = "\"Never give up\"";
else if ( fortune == 4 )
outcome = "\"Love yourself\"";
else if ( fortune == 5 )
outcome = "\"Explore the world\"";
else if ( fortune == 6 )
{
outcome = "\"Do what makes you happy\"";
}
System.out.println( "Fortune cookie says: " + outcome );
System.out.println( + cookie1 + " - " + cookie2 + " - " + cookie3 + " - " + cookie4 + " - " + cookie5 + " - " + cookie6 );
}
}