Assignment 6 – Wacky Sentences

Maximum Points = 50

 

(Due before class on November 14, 2007) The purpose of this assignment is to use loops and arrays in Java to manipulate sounds. In this assignment, you will use:

“Wacky Sentences”” are sentences of three of more words that are randomly constructed from at least three lists of words. Your program is going to create one or more wacky sentences.

Write a Java program that

  1. reads data from three or more files (each file contains an integer followed by that many paths to .wav files of words). Use FileChooser.pickAFile to select the files,
  2. assigns each file containing a word to a Sound object,
  3. constructs a “wacky sentence” using one random word from each file, and
  4. plays the “wacky sentence” using the explore method.

NOTE 1: Make sure the Sound holding the “sentence” is “big” enough to hold the combined words. Remember to include “silence” between words.

NOTE 2: Your program will need to use the Scanner class to read the data from each file:

Scanner scan = new Scanner (new File(fileName));.

You will need to include throws IOException after each method that reads from a file. File I/O requires import java.io.*; in addition to import java.util.Scanner;

NOTE 3: You may need throws SoundException to handles the creation of the Sounds.

Submit the .java file containing your program.

 

Grades are determined using the following scale:

Grading Rubric  (Word document)