For this project, you will use the bag class from Section 5.6, including the grab method that

Question:

For this project, you will use the bag class from Section 5.6, including the grab method that returns a randomly selected element. Use this ADT in a program that does the following:

1. Asks the user for a list of 10 nouns.

2. Asks the user for a list of 10 verbs.

3. Prints some random sentences using the provided nouns and verbs.

For example, if two of the nouns were “monkey” and “piano” and two of the verbs were “eats” and “plays,” we can expect any of these sentences:

The monkey eats the piano.

The monkey plays the piano.

The piano eats the monkey.

The piano plays the monkey.

Needless to say, the sentences are not entirely sensible. Your program will need to declare two bags: one to store the nouns and one to store the verbs. Use an appropriate top-down design.

Fantastic news! We've Found the answer you've been seeking!

Step by Step Answer:

Related Book For  book-img-for-question
Question Posted: