You are to complete this homework before attending the fifth lab.
Solve chapter 4 exercise 5 (printRange, page 297). First solve it in PracticeIt. Then copy and paste the following code into jGRASP and copy your solution from PracticeIt into the program to complete it:
// This program prints results for the 6 test cases from the PracticeIt version // of the printRange problem. It should produce the following output: // [2, 3, 4, 5, 6, 7] // [19, 18, 17, 16, 15, 14, 13, 12, 11] // [5] // [-5, -4, -3, -2, -1, 0, 1, 2] // [1, 0] // [-6, -7, -8, -9] // It is okay if your output has extra blank lines. This would happen if your // printRange method ends with a println. public class PrintRangeTest { public static void main(String[] args) { printRange(2, 7); System.out.println(); printRange(19, 11); System.out.println(); printRange(5, 5); System.out.println(); printRange(-5, 2); System.out.println(); printRange(1, 0); System.out.println(); printRange(-6, -9); System.out.println(); } // include your solution to the printRange method here }
Working on this problem will help prepare you for the homework assignment. Remember that for these warm-up exercises you can talk to each other about how to solve it and even look at each other's solutions. Then you should work on the weekly programming assignment by yourself.