Question: public class WorkingWithBags { // instance variables should be created/initialized by the constructor private BagInterface bagOfStrings; private BagInterface bagOfVowels; // constants should be initialized at

public class WorkingWithBags

{

// instance variables should be created/initialized by the constructor

private BagInterface bagOfStrings;

private BagInterface bagOfVowels;

// constants should be initialized at the definition level

final BagInterface ALL_VOWELS = new ResizableArrayBag<>(new String[]{"a", "e", "i", "o", "u"});

final int MAX_NUMBER_OF_STRINGS_TO_GENERATE = 41;

final int MIN_NUMBER_OF_STRINGS_TO_GENERATE = 35;

final int MAX_STRING_LENGTH = 3;

final int MIN_STRING_LENGTH = 1;

/**

* constructor creates this.bagOfStrings and this.bagOfVowels objects

*/

public WorkingWithBags()

{

// TODO

} // default constructor

/**

* Adds the given entry to this.bagOfStrings if valid

*

* throws InvalidParameterException exception if the length of the string is outside the given bounds

* throws InvalidParameterException exception if the string contains characters other than lowercase letters

*/

public void addToBagOfStrings(String newEntry) throws InvalidParameterException

{

// TODO

}

/**

* Generates randomly string objects and adds them to this.bagOfStrings

*/

public void generateStrings()

{

System.out.println("*** Generating strings ***");

final int SEED = 41;

final int ASCII_LOWERCASE_A = 97;

final int ASCII_LOWERCASE_Z = 122;

Random random = new Random(SEED);

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!