Assignemnt #56 and Fortune Cookies
Code
///Name: Ben Borglin
///Period: 6
///Program name: Fortune Cookie
///file name: FortuneCookie.java
///Date Finsihed: 10/16/15
import java.util.Random;
public class FortuneCookie
{
public static void main ( String[] args )
{
Random r = new Random();
int fortune = 1 + r.nextInt(6);
int lotto1 = 1 + r.nextInt(54);
int lotto2 = 1 + r.nextInt(54);
int lotto3 = 1 + r.nextInt(54);
int lotto4 = 1 + r.nextInt(54);
int lotto5 = 1 + r.nextInt(54);
int lotto6 = 1 + r.nextInt(54);
String response = "";
if (fortune == 1)
{
System.out.println("The fortune you seek is in another cookie");
System.out.println(" " + lotto1 +" - "+ lotto2 +" - "+ lotto3 +" - "+ lotto4 +" - "+ lotto5 +" - "+ lotto6 + "");
}
else if (fortune == 2)
{
System.out.println("Ignore previous fortunes");
System.out.println(" " + lotto1 +" - "+ lotto2 +" - "+ lotto3 +" - "+ lotto4 +" - "+ lotto5 +" - "+ lotto6 + "");
}
else if (fortune == 3)
{
System.out.println("Two days from now, tomorrow will be yesterday.");
System.out.println(" " + lotto1 +" - "+ lotto2 +" - "+ lotto3 +" - "+ lotto4 +" - "+ lotto5 +" - "+ lotto6 + "");
}
else if (fortune == 4)
{
System.out.println("Tomorrow at breakfast, listen carefully: do what rice krispies tell you to.");
System.out.println(" " + lotto1 +" - "+ lotto2 +" - "+ lotto3 +" - "+ lotto4 +" - "+ lotto5 +" - "+ lotto6 + "");
}
else if (fortune == 5)
{
System.out.println("Drive like hell, you will get there.");
System.out.println(" " + lotto1 +" - "+ lotto2 +" - "+ lotto3 +" - "+ lotto4 +" - "+ lotto5 +" - "+ lotto6 + "");
}
else if (fortune == 6)
{
System.out.println("Some days you are pigeon, some days you are statue. Today, bring umbrella.");
System.out.println(" " + lotto1 +" - "+ lotto2 +" - "+ lotto3 +" - "+ lotto4 +" - "+ lotto5 +" - "+ lotto6 + "");
}
else
System.out.println("error.");
}
}
Picture of the output