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
private BagInterface
// constants should be initialized at the definition level
final BagInterface
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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started