Java Strings Project: Mystery Identity Generator

Strings Basics + Concatenation (Student Assignment)

Java Strings Concatenation Scanner Input

Overview

You will write a Java program that asks the user questions and then generates:

  1. A custom Agent Profile (using String concatenation)
  2. A codename built from parts of words (String methods)
  3. A short mission briefing paragraph
Goal: Practice String basics and concatenation with real output that looks like a “profile card.”

1) Spec Sheet (Requirements)

Program Name

P1_MysteryIdentity_LastName.java

Inputs (use Scanner)

Your program must ask for the following:

  1. First name
  2. Last name
  3. Favorite color
  4. Favorite animal
  5. Birth city
  6. Favorite number (integer)
  7. A secret phrase (a short sentence)

String Skills You MUST Use

Required Outputs

A) Agent Profile Card
  • Full name
  • Birth city
  • Favorite color and animal
  • Secret phrase length
B) Codename Generator

Codename rule (required):

  • First 3 letters of favorite color (lowercase)
  • First 3 letters of favorite animal (UPPERCASE)
  • Add the favorite number

Example: Codename: bluTIG42

If the color or animal is shorter than 3 letters, use the whole word.
C) Mission Briefing Paragraph
  • Must be at least 3 sentences
  • Must use String concatenation

2) Pseudocode

START

Create Scanner

Ask user for first name
Ask user for last name
Ask user for favorite color
Ask user for favorite animal
Ask user for birth city
Ask user for favorite number
Ask user for secret phrase

Compute fullName = firstName + " " + lastName

Compute phraseLength = secretPhrase.length()

Create colorPart:
  If color length >= 3, take substring(0,3), else take whole color
  Make it lowercase

Create animalPart:
  If animal length >= 3, take substring(0,3), else take whole animal
  Make it uppercase

Create codename = colorPart + animalPart + favoriteNumber

Print formatted “Agent Profile Card” with new lines and quotes using escape characters

Print codename

Create missionBriefing using 3 sentences and concatenation
Print missionBriefing

END

3) Final Java Code

import java.util.Scanner;

public class P1_MysteryIdentity_LastName {

    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);

        System.out.println("=== Mystery Identity Generator ===");

        // Inputs
        System.out.print("Enter your first name: ");
        String firstName = input.nextLine();
		
		// you need to figure out the rest of the code.
 
 
 
 
 
 

Important: Replace LastName in the file name and class name with your actual last name.

4) Rubric (100 Points)

Category Points What I’m Looking For
A. Program Requirements 40 All required inputs are collected; profile card prints correctly; codename follows the rule; mission briefing is 3+ sentences and uses concatenation.
B. String Skills 35 6+ concatenations; 3+ String methods used correctly; 2+ escape characters used correctly.
C. Code Quality 15 Good variable names; clean formatting; runs without errors; organized sections.
D. Output Professionalism 10 Output is neat, readable, and labeled; no missing info or confusing lines.
Total 100 Complete and correct program with clear output.

5) What to Turn In (Google Classroom Drop-Off)

Files to Submit

  1. Java File:
    P1_MysteryIdentity_LastName.java
  2. Screenshot (Required): Take a screenshot showing your program running with your output.
    Name it:
    P1_MysteryIdentity_LastName.png
  3. Video of the program running:
    P1_MysteryIdentity_LastName.mp4

Submission Instructions

  1. Open the assignment in Google Classroom.
  2. Click Add or Create.
  3. Upload your .java file and your .png screenshot.
  4. Click Turn In.
Double-check: Your file name and class name must match exactly (including capitalization). If they don’t match, your program may not compile.