A Lowercasing Display Function

Write a function that takes in a String and an int. The function will display the given string on the screen the specified number of times, but in all lower-case. Here's the prototype:

public static void display( String s, int n )

In main(), input the message and count, and pass them to the function.

Strings have a built-in method that will return a lowercased version of the String. It is called toLowerCase().

Message: WhateVer haPPeneD to CapitaLizatiOn?  It used to bE so CooL....
Quantity: 10

whatever happened to capitalization?  it used to be so cool....
whatever happened to capitalization?  it used to be so cool....
whatever happened to capitalization?  it used to be so cool....
whatever happened to capitalization?  it used to be so cool....
whatever happened to capitalization?  it used to be so cool....
whatever happened to capitalization?  it used to be so cool....
whatever happened to capitalization?  it used to be so cool....
whatever happened to capitalization?  it used to be so cool....
whatever happened to capitalization?  it used to be so cool....
whatever happened to capitalization?  it used to be so cool....

Also, remember that you will need to use nextLine() instead of next() if you want to read in a String containing multiple words separated by whitespace.




©2013 Graham Mitchell

This assignment is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 United States License.
Creative Commons License