printRange
Category: Programming
Author: Stuart Reges
Book Chapter: 5.2
Problem: printRange
Write a method printRange that takes two integers as parameters, a low and a high, and that prints out all integers in the range from low to high inclusive inside square brackets and separated by commas. For example, the call: printRange(5, 10); should produce the following output: [5,6,7,8,9,10] Your method should produce a complete line of output. If low and high are equal, the output should be a list with just one number. If low is larger than high, the output should be an empty list (with just the square brackets). Your method should also work properly for negative integers. For example, the following series of calls: printRange(3, 3); printRange(10, 1); printRange(-10, -5); printRange(-5,-10); should produce the following four lines of output: [3] [] [-10,-9,-8,-7,-6,-5] [] Write your solution to printRange below.