Lab 13: Loops, again

Objective

 practice loops with  1) a palindrome checker and 2) a small task that prints a given string in a grid whose dimensions are given by the user. This will be practice mostly for for loops, iterating over a string and decomposing a problem into subproblems. Consider the following output for both problems:

Palindrome checker

A palindrome is a word or string that is spelled the same “forward and backwards” or, said differently, the reverse of the string is the same as the original. Think about how you might do this before starting.

You will need:

·         String.length()

·         To index the string, probably with charAt(). Remember the first character is at index 0 and

·         There are multiple ways to solve this – one creates another string and the other just uses the given string.

S to the X to the Y

·         Read in a string and the dimensions of a grid (width and height)

·         Print out width-many copies of the string, followed by spaces…

·         height-many times (with appropriate new lines).