Overview
You will write a Java program that asks the user questions and then generates:
- A custom Agent Profile (using String concatenation)
- A codename built from parts of words (String methods)
- 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:
- First name
- Last name
- Favorite color
- Favorite animal
- Birth city
- Favorite number (integer)
- A secret phrase (a short sentence)
String Skills You MUST Use
- At least 6 examples of String concatenation using
+ - At least 3 String methods, chosen from:
.length().toUpperCase().toLowerCase().substring(a, b).indexOf("...").equals(...)
- At least 2 uses of escape characters, like:
\"(quotes inside a String)\n(new line)\t(tab)
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
-
Java File:
P1_MysteryIdentity_LastName.java -
Screenshot (Required): Take a screenshot showing your program running with your output.
Name it:P1_MysteryIdentity_LastName.png -
Video of the program running:
P1_MysteryIdentity_LastName.mp4
Submission Instructions
- Open the assignment in Google Classroom.
- Click Add or Create.
- Upload your
.javafile and your.pngscreenshot. - 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.