printStrings
Category: Token-Based File Processing
Author: Stuart Reges
Book Chapter: 6.2
Problem: printStrings
Write a static method printStrings that takes as a parameter a Scanner holding a sequence of integer/String pairs and that prints to System.out one line of output for each pair with the given String repeated the given number of times. For example if the Scanner contains the following data: 6 fun. 3 hello 10 4 wow! your method should produce the following output: fun.fun.fun.fun.fun.fun. hellohellohello wow!wow!wow!wow! Notice that there is one line of output for each integer/String pair. The first line has 6 occurrences of "fun.", the second line has 3 occurrences of "hello", the third line has 10 occurrences of "" and the fourth line has 4 occurrences of "wow!". Notice that there are no extra spaces included in the output. You are to exactly reproduce the format of this sample output. You may assume that the input values always come in pairs with an integer followed by a String. If the Scanner is empty (no integer/String pairs), your method should produce no output. Write your solution to printStrings below.