Assignment 56, Fortune Cookie
Code
///Name: Stella Koliavas
///Period: 5
///Program Name: Fortune
///File Name: Fortune.java
///Date Finshed: 12/3/15
import java.util.Random;
import java.util.Scanner;
public class Fortune
{
public static void main ( String[] args )
{
Random r = new Random();
Scanner siri = new Scanner(System.in);
int x = 1 + r.nextInt(6);
if (x == 1)
System.out.println( "Here is your fortune: \"You will die soon\" ");
if (x == 2)
System.out.println( "Here is your fortune: \"Hold your family near your heart\" ");
if (x == 3)
System.out.println( "Here is your fortune: \"You will find true love soon\" ");
if (x == 4)
System.out.println( "Here is your fortune: \"Love yourself and others will love you too\" ");
if (x == 5)
System.out.println( "Here is your fortune: \"Money is not the wisest path to follow\" ");
if (x == 6)
System.out.println( "Here is your fortune: \"You will find a true friend in the nearby future\" ");
System.out.print( 1 + r.nextInt(54) + " - " );
System.out.print( 1 + r.nextInt(54) + " - " );
System.out.print( 1 + r.nextInt(54) + " - " );
System.out.print( 1 + r.nextInt(54) + " - " );
System.out.print( 1 + r.nextInt(54) + " - " );
System.out.print( 1 + r.nextInt(54) + " " );
System.out.println();
}
}
Picture of the output