// Complete class structure from OurThreeStoogesDemo2.java
public class OurThreeStoogesDemo2 {
// Class constants for ALL the Stooges (including the fourth!)
public static final String MOE = "Moe";
public static final String LARRY = "Larry";
public static final String CURLY = "Curly";
public static final String SHEMP = "Shemp";
// DRIVER CODE - Main method is the entry point
public static void main(String[] args) {
System.out.println("š Welcome to the COMPLETE Three Stooges Command Line Adventure! š");
System.out.println("=".repeat(65));
System.out.println("šŖ Now featuring ALL FOUR classic Stooges! šŖ");
// Check if we have any command-line arguments
if (args.length == 0) {
displayUsageInstructions();
return;
}
// Display what arguments were received
System.out.println("\nArguments received: " + args.length);
for (int i = 0; i < args.length; i++) {
System.out.println(" args[" + i + "] = \"" + args[i] + "\"");
}
System.out.println();
// Process the first argument as a Stooge name
String stoogeName = args[0];
handleStoogeGreeting(stoogeName);
// If we have a second argument, treat it as an action
if (args.length >= 2) {
String action = args[1];
performStoogeAction(stoogeName, action);
}
// If we have three or more arguments, create a Stooge scenario
if (args.length >= 3) {
createStoogeScenario(args);
}
// Special feature: Display Stooge history if requested
if (args.length >= 2 && args[1].equalsIgnoreCase("history")) {
displayStoogeHistory(stoogeName);
}
System.out.println("\nš¬ That's all folks! Nyuk, nyuk, nyuk! š¬");
}
// Additional methods would follow here:
// displayUsageInstructions(), handleStoogeGreeting(),
// performStoogeAction(), createStoogeScenario(), etc.
}
Example 1: No arguments (shows usage)
C:\> javac OurThreeStoogesDemo2.java
C:\> java OurThreeStoogesDemo2
šØ Whoops! The Stooges need some input! šØ
Usage Instructions:
java OurThreeStoogesDemo2 <stooge_name> [action] [prop1] [prop2] ...
Valid Stooge Names: Moe, Larry, Curly, Shemp
Sample Actions: bonk, poke, slap, dodge, fall, history
Sample Props: hammer, pie, ladder, door, wrench
Examples:
java OurThreeStoogesDemo2 Moe
java OurThreeStoogesDemo2 Shemp bonk
java OurThreeStoogesDemo2 Curly history
Example 2: Single Stooge greeting
C:\> java OurThreeStoogesDemo2 Moe
š Welcome to the COMPLETE Three Stooges Command Line Adventure! š
=================================================================
šŖ Now featuring ALL FOUR classic Stooges! šŖ
Arguments received: 1
args[0] = "Moe"
šŖ Introducing our star performer: Moe! šŖ
šØ Moe says: "Why, you knucklehead!"
*adjusts suspenders and scowls menacingly*
š” Fun fact: Moe was the leader and straight man of the group!
š¬ That's all folks! Nyuk, nyuk, nyuk! š¬
Example 3: Stooge with action
C:\> java OurThreeStoogesDemo2 Curly bonk
š Welcome to the COMPLETE Three Stooges Command Line Adventure! š
=================================================================
šŖ Now featuring ALL FOUR classic Stooges! šŖ
Arguments received: 2
args[0] = "Curly"
args[1] = "bonk"
šŖ Introducing our star performer: Curly! šŖ
šµ Curly says: "Nyuk, nyuk, nyuk! Soitenly!"
*spins around on floor and does the famous 'woo-woo-woo'*
š” Fun fact: Curly was the most popular Stooge with his childlike antics!
š¬ Curly is about to bonk!
*BONK!* šØ Ouch! That's gotta hurt!
š¬ That's all folks! Nyuk, nyuk, nyuk! š¬
Example 4: History feature
C:\> java OurThreeStoogesDemo2 Shemp history
š Welcome to the COMPLETE Three Stooges Command Line Adventure! š
=================================================================
šŖ Now featuring ALL FOUR classic Stooges! šŖ
Arguments received: 2
args[0] = "Shemp"
args[1] = "history"
šŖ Introducing our star performer: Shemp! šŖ
š¤ Shemp says: "Eeb-eeb-eeb-eeb! I'm a victim of soicumstance!"
*waves hands frantically and makes scared faces*
š” Fun fact: Shemp was an original Stooge who returned when Curly got sick!
š STOOGE HISTORY LESSON! š
========================================
š¤ SHEMP HOWARD (1895-1955)
⢠Real name: Samuel Horwitz
⢠Role: Original third Stooge, then replacement for Curly
⢠Famous for: "Eeb-eeb-eeb!" and scared expressions
⢠Career: 77 shorts (1930-1932, 1946-1955)
⢠Trivia: Was Moe and Curly's actual brother!
========================================
š¬ That's all folks! Nyuk, nyuk, nyuk! š¬
Example 5: Full scenario with props
C:\> java OurThreeStoogesDemo2 Moe slap Larry hammer pie
š Welcome to the COMPLETE Three Stooges Command Line Adventure! š
=================================================================
šŖ Now featuring ALL FOUR classic Stooges! šŖ
Arguments received: 5
args[0] = "Moe"
args[1] = "slap"
args[2] = "Larry"
args[3] = "hammer"
args[4] = "pie"
šŖ Introducing our star performer: Moe! šŖ
šØ Moe says: "Why, you knucklehead!"
*adjusts suspenders and scowls menacingly*
š” Fun fact: Moe was the leader and straight man of the group!
š¬ Moe is about to slap!
*SLAP!* ā The sound echoes through the room!
š CREATING A FULL STOOGES SCENARIO! š
Cast and Props:
1. Moe (Main Character)
2. slap (Action)
3. Larry (Supporting Stooge)
4. hammer (Prop)
5. pie (Prop)
š¬ Scene: The Classic Stooge Mix-up! š¬
Moe starts the chaos by trying to slap...
With 2 Stooges involved, you KNOW this will be chaos!
Larry gets caught in the mayhem!
A hammer becomes part of the disaster!
A pie becomes part of the disaster!
The result? Total pandemonium! Classic Stooges comedy! š¤£
š Array Analysis:
Total arguments: 5
Stooges involved: 2
Last argument: "pie"
Array indices range from 0 to 4
š¬ That's all folks! Nyuk, nyuk, nyuk! š¬
// Java greeting method from OurThreeStoogesDemo2.java
public static void handleStoogeGreeting(String stoogeName) {
System.out.println("šŖ Introducing our star performer: " + stoogeName + "! šŖ");
if (stoogeName.equalsIgnoreCase(MOE)) {
System.out.println("šØ Moe says: \"Why, you knucklehead!\"");
System.out.println(" *adjusts suspenders and scowls menacingly*");
} else if (stoogeName.equalsIgnoreCase(LARRY)) {
System.out.println("š„“ Larry says: \"I'm trying to think, but nothing happens!\"");
System.out.println(" *scratches wild frizzy hair*");
} else if (stoogeName.equalsIgnoreCase(CURLY)) {
System.out.println("šµ Curly says: \"Nyuk, nyuk, nyuk! Soitenly!\"");
System.out.println(" *spins around on floor*");
} else if (stoogeName.equalsIgnoreCase(SHEMP)) {
System.out.println("š¤ Shemp says: \"Eeb-eeb-eeb-eeb!\"");
System.out.println(" *waves hands frantically*");
}
}
// Java action method from OurThreeStoogesDemo2.java
public static void performStoogeAction(String stoogeName, String action) {
System.out.println("š¬ " + stoogeName + " is about to " + action + "!");
String actionLower = action.toLowerCase();
switch (actionLower) {
case "bonk":
if (stoogeName.equalsIgnoreCase(SHEMP)) {
System.out.println(" *BONK!* šØ \"Eeb-eeb-eeb!\"");
} else {
System.out.println(" *BONK!* šØ Ouch!");
}
break;
case "poke":
System.out.println(" *POKE!* ššļø \"Hey, watch the eyes!\"");
break;
// ... more cases
}
}
// Java history method from OurThreeStoogesDemo2.java
public static void displayStoogeHistory(String stoogeName) {
System.out.println("š STOOGE HISTORY LESSON! š");
System.out.println("=".repeat(40));
if (stoogeName.equalsIgnoreCase(MOE)) {
System.out.println("š© MOE HOWARD (1897-1975)");
System.out.println("⢠Real name: Moses Harry Horwitz");
System.out.println("⢠Role: The leader and 'straight man'");
// ... more info
}
// ... other Stooges
}