Time to combine everything: variables and operators from 1.1, and String methods from 1.2. You'll write a program that slices pieces out of your own name with substring, measures it with length(), computes your power level with operators, and forges them all into a one-of-a-kind gamertag. Nobody else's program prints your tag.
Example run for a player named Jordan Mitchell. Yours prints your tag — and the style of the card is yours to design.
*****************************
GAMERTAG FORGE
*****************************
Player: Jordan Mitchell
Letters in your name: 14
Power level: 42
>>> Your tag: JorMi42 <<<
*****************************
Tag forged. Wear it well.
*****************************
(firstName.length() + lastName.length()) * 3 — Jordan (6) + Mitchell (8) = 14, times 3 = 42..substring() at least twice — slice a piece from BOTH names — and .length() at least once.String tag = piece1 + piece2 + power; — then print the variable, not the pieces.*, /, -, or %) using .length() values from your name.(int)(Math.random() * 10) · grow your tag with += · forge a second tag for the person next to you and print both cards.Copy this in and run it first. Then swap in your name and start forging where the comments point.
public class GamertagForge
{
public static void main(String[] args)
{
// 1. YOUR NAME (swap in your own)
String firstName = "Jordan";
String lastName = "Mitchell";
// 2. THE FORGE: slice substring pieces, compute your power level,
// and build your tag in its own String variable
// 3. THE REVEAL CARD: print it with your tag inside
System.out.println("*****************************");
System.out.println("*****************************");
}
}
Before you show Mr. Babb: paste your whole program below and hit the button. It checks your code against every requirement — green means go.