Lab Homework 6

You are to complete this homework before attending the seventh lab.

Solve chapter 6 exercise 7 (wordWrap, page 420). 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 tests the wordWrap method.  This line and two others end up
// being split into two lines.

import java.io.*;
import java.util.*;

public class WordWrapTest {
   public static void main(String[] args) throws FileNotFoundException {
      Scanner input = new Scanner(new File("WordWrapTest.java"));
      wordWrap(input);
   }

   // include your solution to the wordWrap 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.