Assignemnt #57
Code
/// Name: Connor Siri
/// Period: 7
/// Program Name: Fortune
/// File Name: Frotune.java
/// Date Finished: 10/28/2015
import java.util.Random;
import java.util.Scanner;
public class Fortune
{
public static void main ( String[] args )
{
Random r = new Random();
Scanner keyboard = new Scanner(System.in);
int x = 1 + r.nextInt(6);
String response = "";
if ( x == 1 )
{
System.out.println("Fortune cookie says: \"You will meet someone new soon\"");
}
if ( x == 2 )
{
System.out.println("Fortune cookie says: \"A piano will fall on you\"");
}
if ( x == 3 )
{
System.out.println("Fortune cookie says: \"You will fall off a building\"");
}
if ( x == 4 )
{
System.out.println("Fortune cookie says: \"Have a good day you will\"");
}
if ( x == 5 )
{
System.out.println("Fortune cookie says: \"Your food will look funny\"");
}
if ( x == 6 )
{
System.out.println("Fortune cookie says: \"Good things will come\"");
}
System.out.print( 1 + r.nextInt(54) + " " );
System.out.print(" - " );
System.out.print( 1 + r.nextInt(54) + " " );
System.out.print(" - " );
System.out.print( 1 + r.nextInt(54) + " " );
System.out.print(" - " );
System.out.print( 1 + r.nextInt(54) + " " );
System.out.print(" - " );
System.out.print( 1 + r.nextInt(54) + " " );
System.out.print(" - " );
System.out.println( 1 + r.nextInt(54) + " " );
}
}
Picture of the output