Assignment #56 Fortune Cookie
Code
///Name: Ian Grant
///Period:5
///Project Name: Fortune Cookie
///File Name:FortCookie.java
///11/7/15
import java.util.Random;
public class FortCookie
{
public static void main(String[] args)
{
Random r=new Random();
int fort;
fort=1+r.nextInt(6);
if (fort==1)
{
System.out.println("Fortune cookie says: \"Be Kind.\" ");
System.out.println("Lotto numbers: "+(1+r.nextInt(54))+" - "+(1+r.nextInt(54))+" - "+(1+r.nextInt(54))+" - "+(1+r.nextInt(54))+" - "+(1+r.nextInt(54))+" - "+(1+r.nextInt(54)));
}
else if (fort==2)
{
System.out.println("Fortune cookie says: \"Don't be kind.\" ");
System.out.println("Lotto numbers: "+(1+r.nextInt(54))+" - "+(1+r.nextInt(54))+" - "+(1+r.nextInt(54))+" - "+(1+r.nextInt(54))+" - "+(1+r.nextInt(54))+" - "+(1+r.nextInt(54)));
}
else if (fort==3)
{
System.out.println("Fortune cookie says: \"Go to Mars, there's to many people here.\" ");
System.out.println("Lotto numbers: "+(1+r.nextInt(54))+" - "+(1+r.nextInt(54))+" - "+(1+r.nextInt(54))+" - "+(1+r.nextInt(54))+" - "+(1+r.nextInt(54))+" - "+(1+r.nextInt(54)));
}
else if (fort==4)
{
System.out.println("Fortune cookie says: \"Make money get happy. \" ");
System.out.println("Lotto numbers: "+(1+r.nextInt(54))+" - "+(1+r.nextInt(54))+" - "+(1+r.nextInt(54))+" - "+(1+r.nextInt(54))+" - "+(1+r.nextInt(54))+" - "+(1+r.nextInt(54)));
}
else if (fort==5)
{
System.out.println("Fortune cookie says: \"You can't buy happnies, but you can rent it!\" ");
System.out.println("Lotto numbers: "+(1+r.nextInt(54))+" - "+(1+r.nextInt(54))+" - "+(1+r.nextInt(54))+" - "+(1+r.nextInt(54))+" - "+(1+r.nextInt(54))+" - "+(1+r.nextInt(54)));
}
else if (fort==6)
{
System.out.println("Fortune cookie says: \"Be a wolf.\" ");
System.out.println("Lotto numbers: "+(1+r.nextInt(54))+" - "+(1+r.nextInt(54))+" - "+(1+r.nextInt(54))+" - "+(1+r.nextInt(54))+" - "+(1+r.nextInt(54))+" - "+(1+r.nextInt(54)));
}
else
System.out.println("You broke a the fortune cookie and the paper explodes. Not a good omen.");
}
}
Output