Assignment #55 and Fifty-Second Program
Code
/// Name: Georgi Atanasov
/// Period: 5
/// Program Name: Fortune Cookie
/// File Name: FortuneCookie.java
/// Date Finished: 12/3/2015
import java.util.Random;
public class FortuneCookie
{
public static void main(String[] args)
{
Random r = new Random();
int fortune = 1 + r.nextInt(6);
int fort1 = 1 + r.nextInt(54);
int fort2 = 1 + r.nextInt(54);
int fort3 = 1 + r.nextInt(54);
int fort4 = 1 + r.nextInt(54);
int fort5 = 1 + r.nextInt(54);
int fort6 = 1 + r.nextInt(54);
if (fortune == 1)
System.out.println("Fortune cookie says: \"Do what you love.\"");
else if (fortune == 2)
System.out.println("Fortune cookie says: \"You will soon be given a great opportunity.\"");
else if (fortune == 3)
System.out.println("Fortune cookie says: \"You will get into a great college.\"");
else if (fortune == 4)
System.out.println("Fortune cookie says: \"You will be revered by those dear to you.\"");
else if (fortune == 5)
System.out.println("Fortune cookie says: \"Nothing special.\"");
else if (fortune == 6)
System.out.println("Fortune cookie says: \"You will find your passion for pastoral life.\"");
else
System.out.println("Fortune Error");
System.out.println(" " + fort1 + " - " + fort2 + " - " + fort3 + " - " + fort4 + " - " + fort5 + " - " + fort6);
}
}
Picture of the output