Assignemnt #49 Gender Games
Code
///Name: Morgan Kaplan
///Period: 5
///Project Name: Gender Games
///File Name: GenderGames.java
import java.util.Scanner;
public class GenderGames
{
public static void main( String[] args )
{
Scanner momo= new Scanner(System.in);
int age;
String FirstName, LastName, gender, relationship;
System.out.println( "What is your first name? " );
FirstName=momo.next();
System.out.println( "What is your last name? " );
LastName=momo.next();
System.out.println( "Are you a boy or a girl" );
gender=momo.next();
if ( gender.equals("girl"))
{
System.out.println( "How old are you?" );
age=momo.nextInt();
if ( age>20)
{
System.out.println( "Are you married?" );
relationship=momo.next();
if ( relationship.equals("yes"))
{
System.out.println( "Then I shall call you Mrs. " + LastName + "." );
}
if ( relationship.equals("no"))
{
System.out.println( "The I shall call you Ms. " + LastName + "." );
}}
if ( age< 20)
{
System.out.println( "Then I shall call you " + FirstName + " " + LastName + "" );
}
}
if ( gender.equals("boy"))
{
System.out.println( "How old are you" );
age=momo.nextInt();
if ( age> 20)
{
System.out.println( "Then I shall call you Mr. " + LastName + "." );
}
if ( age< 20)
{
System.out.println( "Then I shall call you " + FirstName + " " + LastName + "." );
}
}} }
Picture of Output