Assignment #56 and Fortune Cookie
Code
/// Name: Trent Lane
/// Period: 6
/// Program Name: Fortune Cookie
/// Date Finished: 11/20/2015
import java.util.Random;
public class FortuneCookie
{
public static void main(String[] args)
{
Random r = new Random();
int fortune = 2 + r.nextInt(6);
int fortune1 = 2 + r.nextInt(54);
int fortune2 = 2 + r.nextInt(54);
int fortune3 = 2 + r.nextInt(54);
int fortune4 = 2 + r.nextInt(54);
int fortune5 = 2 + r.nextInt(54);
int fortune6 = 2 + r.nextInt(54);
if (fortune == 1)
System.out.println("Fortune cookie says: \"You will find great success financially today.\"");
else if (fortune == 2)
System.out.println("Fortune cookie says: \"Do things that are important to you and good things will follow.\"");
else if (fortune == 3)
System.out.println("Fortune cookie says: \"You will soon witness the end to a great relationship.\"");
else if (fortune == 4)
System.out.println("Fortune cookie says: \"You will find great misfortune in your future.\"");
else if (fortune == 5)
System.out.println("Fortune cookie says: \"Please try again.\"");
else if (fortune == 6)
System.out.println("Fortune cookie says: \"There is nothing positive in YOUR future.\"");
else
System.out.println("Error");
System.out.println(" " + fort1 + " - " + fort2 + " - " + fort3 + " - " + fort4 + " - " + fort5 + " - " + fort6);
}
}
Picture of the output