Assignemnt #49 and Gender Game
Code
///Name: Dakota Donahue
///Period: 5
///Project Name:Gender Game
///File Name:GenderGame
///Date: 11/5/2015
import java.util.Scanner;
public class GenderGame
{
public static void main( String[] args )
{
Scanner keyboard = new Scanner(System.in);
String gD, fN, lN, mD;
int age;
System.out.println( " Are you male or female (M/F) ");
gD = keyboard.next();
System.out.println( " First Name: ");
fN = keyboard.next();
System.out.println( " Last Name: ");
lN = keyboard.next();
System.out.println(" Age: ");
age = keyboard.nextInt();
if ( age >= 20 )
{
System.out.println("\n Are you married? (Y/N) \n" );
mD = keyboard.next();
if ( mD.equals("Y") )
{
if ( gD.equals("M") )
{
System.out.println( "Then I shall call you Mr. " + lN + ". " );
}
else if ( gD.equals("F") )
{
System.out.println( "Then I shall call you Mrs. " + lN + ". " );
}
}
else if ( mD.equals("N") )
{
if ( gD.equals("M") )
{
System.out.println( "Then I shall call you Mr. " + lN + ". " );
}
else if ( gD.equals("F") )
{
System.out.println( "Then I shall call you Ms. " + lN + ". " );
}
}
}
else if ( age <= 20 )
{
if ( gD.equals("M") )
{
System.out.println( "Then I shall call you " + fN + " " + lN + ". " );
}
else if ( gD.equals("F") )
{
System.out.println( "Then I shall call you " + fN + " " + lN + ". " );
}
}
}
}