Assignment #49 Gender Game
Code
/// Name: Lacey Reese
/// Period: 5
/// Program Name: GenderGame
/// File Name: GenderGame.java
/// Date Finished 11/19/2015
import java.util.Scanner;
public class GenderGame
{
public static void main( String[] args )
{
Scanner keyboard = new Scanner(System.in);
String Gender, FName, LName, Married;
int Age;
System.out.print( "What is your gender (Male or Female): " );
Gender = keyboard.next();
System.out.print( "First Name: " );
FName = keyboard.next();
System.out.print( "Last Name: " );
LName = keyboard.next();
System.out.print( "Age: " );
Age = keyboard.nextInt();
System.out.println();
if ( Gender.equals("Female") && Age >= 20 )
{
System.out.print( "Are you married, " + FName + " (Yes or No)? " );
Married = keyboard.next();
System.out.println();
if ( Married.equals("Yes") )
{
System.out.println( "Then I shall call you Mrs. " + LName + "." );
}
if ( Married.equals("No") )
{
System.out.println( "Then I shall call you Ms. " + LName + "." );
}
}
if ( Age < 20 )
{
System.out.println( "Then I shall call you " + FName + "." );
}
if ( Gender.equals("Male") && Age >= 20 )
{
System.out.println( "Then I shall call you Mr. " + LName + "." );
}
}
}
Picture of the output
//