Assignment #49 and Gender Game
Code
/// Name: Graham Pollock
/// Period: 5
/// Program Name: Gender Game
/// File Name: GenderGame.java
/// Date Finished: 11/09/2015/
import java.util.*;
public class GenderGame
{
public static void main( String[] args)
{
Scanner keyboard = new Scanner(System.in);
String first, last, gender, status;
int age;
System.out.print("What Is your Gender (M or F): ");
gender = keyboard.next();
System.out.print("First Name: ");
first = keyboard.next();
System.out.print("Last Name: ");
last = keyboard.next();
System.out.print("Age: ");
age = keyboard.nextInt();
System.out.println();
if (gender.equals("F") && age >= 20 )
{
System.out.println("Are You Married " + first + "?");
status = keyboard.next();
if (status.equals("yes"))
{
System.out.println("Then I Shall Call you Mrs. " + last);
}
if (status.equals("no"))
{
System.out.println("Then I Shall Call you Ms. " + last);
}
}
if (gender.equals("F") && age < 20 )
{
System.out.println("Then I Shall Call You " + first + " " + last );
}
if (gender.equals("M") && age >= 20 )
{
System.out.println("Then I shall Call You Mr. " + last);
}
if (gender.equals("M") && age < 20 )
{
System.out.println("Then I shall Call You " + first + " " + last );
}
}
}
Picture of the output