RU beehive logo ITEC dept promo banner
ITEC 120
2019fall
asbrennem
ibarland

intro to arrays
acronyms

What is light-amplified stimulated emission radiation? Why, that's a L.A.S.E.R. of course! This abbreviation is called an acronym.

In lecture, we saw arrays-of-doubles. We will apply similar concepts, but using an array-of-Strings.

  1. Re-download the latest Object120.java.
  2. Write a test-method testAcronymize. It should contain at least two other interesting test cases beyond:
            assertEquals( "S.C.U.B.A.", acronymize( new String[]{"Self", "contained", "underwater", "breathing", "apparatus"} ) );
          
    (Hint: think along the lines of "An array of size 0, and size 1, and size many.)
  3. Write a stub method for acronymize. Make sure it compiles and runs (and fails) your tests.
  4. Complete the body for acronymize.
    Think about:
    Hint: The built-in function Character.toUpperCase('z') returns 'Z'.
  5. Submit your file to D2L, as lab07a.
  6. Bonus task: Have your main method prompt the user for a sentence, and then print its acronym. Repeat this until the user types "quit" as the sentence.

    Hints:


logo for creative commons by-attribution license
This page licensed CC-BY 4.0 Ian Barland
Page last generated
Please mail any suggestions
(incl. typos, broken links)
to ibarlandradford.edu
Rendered by Racket.