Assignemnt #49 Gender Game
Code
///Tyler Hart
///period 5
///Gender Game
///Triggering.java
///10/21/2015
import java.util.Scanner;
public class Triggering
{
public static void main( String [] args)
{
Scanner keyboard = new Scanner(System.in);
String first, gender, last, mar, knight;
int age;
System.out.println("What is your gender \"M\", \"F\", \"B\"icycle, or \"O\"ther?");
gender = keyboard.next();
System.out.println("First name: ");
first = keyboard.next();
System.out.println("Last name: ");
last = keyboard.next();
System.out.println("Age: ");
age = keyboard.nextInt();
if (gender.equals("F") && age >= 20)
{
System.out.println("Are you married, "+first+" (y or n)?");
mar = keyboard.next();
if (mar.equals("y"))
{
System.out.println("then i will call you Mrs "+last);
}
else if (mar.equals("n"))
{
System.out.println("then i will call you Ms. "+last);
}
}
else if (age < 20)
{
System.out.println("then i will call you "+first+" "+last);
}
else if (gender.equals("B"))
{
System.out.println("then i will call you Bicycle "+last);
}
else if (gender.equals("O"))
{
System.out.println("then i will call you "+first+" "+last);
}
else if (gender.equals("M"))
{
System.out.println("Are you Knighted, "+first+" (y or n)?");
knight = keyboard.next();
if (knight.equals("y"))
{
System.out.println("then i will call you Sir "+last);
}
else
{
System.out.println("then i will call you Mr. "+last);
}
}
else
{
System.out.println("I do not know waht to call you.");
}
}
}
Picture of the output