A computer screen displaying Java code with the text 'Java Programming'" Caption: "Coding in Java
Coding in Java

Recreating the Classic Burma Shave Roadside Rhymes with Java

From 1925 through 1963, Burma Shave advertising signs appeared next to highways
all across the United States. There were always four or five signs in a row containing
pieces of a rhyme, followed by a final sign that read “Burma Shave.” For example,
one set of signs that has been preserved by the Smithsonian Institution reads as
follows:
Shaving brushes
You’ ll soon see ’em
On a shelf
In some museum
Burma Shave
Find a classic Burma Shave rhyme on the Web. Write, compile, and test a class that
produces a series of four dialog boxes so that each displays one line of a Burma
Shave slogan in turn. Save the class as BurmaShave.java
import javax.swing.*;

public class BurmaShave {
    public static void main(String[] args) {
        String line1="Shaving brushes";
        String line2="you'll soon see 'em";
        String line3="on a shelf";
        String line4="in a museum";
        String line5="Burma Shave";
        JOptionPane.showMessageDialog(null,line1);
        JOptionPane.showMessageDialog(null,line2);
        JOptionPane.showMessageDialog(null,line3);
        JOptionPane.showMessageDialog(null,line4);
        JOptionPane.showMessageDialog(null,line5);

    }
}

Explanation

The statement describes a type of advertising that was prevalent in the United States from 1925 to 1963. Burma Shave was a brand of shaving cream that used a series of road signs to advertise its products. These signs were placed alongside highways and consisted of four or five signs in a row that contained pieces of a rhyme. The last sign in the series would always read “Burma Shave.”

One example of a Burma Shave rhyme has been preserved by the Smithsonian Institution and reads as follows: “Shaving brushes, you’ll soon see ’em, on a shelf, in some museum, Burma Shave.”

The statement then asks the reader to find a classic Burma Shave rhyme on the web and use it to write, compile, and test a Java class. The class should produce a series of four dialog boxes, each of which displays one line of a Burma Shave slogan. The class should be saved as “BurmaShave.java.”