Algorithm Development – CS239

Department of Computer Science

Dr.Adams’ Class

Ms. Harris’ Class

 

Software Requirements Specification

Programming Assignment 5

The Land of Neptune

Due Date

Deliverable

Where

04/19/05

All three classes

Adams – Blackboard Assignment

Harris – helium submit

04/20/05

Hardcopy printout

In class

 

Introduction

Purpose: The Neptonian language has been widely studied by the planetary linguist, Arthur Dent II.  You will write a program that will generate Neptonian words and evaluate words which we believe to be Neptonian to see if they in fact are.

Background

General Information: All words take the form of Blurbs.  A Blurb is a Whoozie followed by one or more Whatzits.  A Whoozie is the character ‘x’ followed by zero or more y’s.  A Whatzit is a ‘q’ followed by either a ‘z’ or a ‘d’, followed by a Whoozie. 

In an effort to try to communicate with the Neptonians, we want to write an application to generate random Blurbs and to put these together to form Sentences.  Your program should use a recursive routine to generate these random Blurbs.

 

In addition, to insure that the verbal Neptonian responses are being received properly, we need a method to accept a String and return true if it is in fact a “legal” Blurb or false if it is not.

 

Existing Components:  You will write this application from Scratch.  You may use existing java classes, but all other work will be your own.

 

New Components: You must develop the following classes:

Blurb

BlurbSentence

BlurbDriver

 

These classes must not be in a package. Detailed requirements for each of these classes are given below.

Blurb class:

The Blurb class must:

1.      Contain a single String attribute that represents this Blurb.

2.      Contain a Constructor that takes in a String and sets the attribute to its value if it is a valid Blurb.

3.      Contain a recursive method makeRandomBlurb which accepts no parameters and returns a Blurb object.

4.      Contain a recursive method checkBlurb which accepts a String and returns true if the String is a Blurb and false if not.

 

This class may contain other methods and attributes as well.

The BlurbSentence class:

The BlurbSentence class must:

1.      Contain an ArrayList of Blurbs as its attribute.

2.      Contain an add method that adds a new Blurb to the end of the list.

3.      Contain a toString method that prints the sentence, capitalizing the first word and placing a period at the end of the last.

 

This class may contain other methods and attributes as well.

A BlurbDriver:

The BlurbDriver must:

Test all of the methods of both the BlurbSentence and the Blurb classes.  It should use prompts to solicit Blurbs from the user which can be tested by the checkBlurb method.  A loop should allow the user to enter any number of Blurbs for checking.

Hints:

1.      This is not a large application, but with its reliance on recursive methods, you will want to start on it early.  Be aware that PA6 will be assigned before PA5 is due.

2.      As always, build and test a method at a time.

 

Grading:

Properly working recursive method to generate random Blurbs

35%

Properly working recursive method to test random Blurbs

25%

All three classes

20%

Documentation/style issues/efficiency issues

20%

 

Copyright © 2005