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.
Step by Step Answer:
include include include Bagh using namespace std Function prototypes void getUserInputBag nouns Bag ...View the full answer
Students also viewed these Computer science questions
-
A compare-exchange operation on two array elements A[i] and A[j], where i < j, has the form COMPARE-EXCHANGE (A, i, j) 1 If A[i] > A[j] 2 exchange A[i] with A[j] After the compare-exchange operation,...
-
For this project you are tasked with building a user application that will select sets of random numbers. Your application must use functions and pass values. Your program will pick sets of 6 random...
-
In this assignment you will write a program that will simulate a storage area with collections of items. Items can be added, removed, and the user can check the value of an item. This assignment does...
-
Ruff, Tuff, and Duff are parners sharing profits and losses 30/30/40 respectively. Their balance sheet is below: Cash Receivable from Ruff Property & Equipment $200,000 10,000 500,000 $710,000...
-
Masses (in kg) of samples of the contents in cans of regular Coke and regular Pepsi: Coke: 0.3724 0.3705 0.371 0.3732 0.3719 0.3749 Pepsi: 0.3754 0.3707 0.3732 0.3714 0.3735 0.3774
-
Use a graphing utility to find the intersection points of the curves, and then use the utility to find the area of the region bounded by the curves. y = x + 1, y = (x - 1) 2
-
Give two arguments for and two arguments against partial-birth abortions.
-
Prepare journal entries to record the following merchandising transactions of Cabela's, which uses the perpetual inventory system and the gross method. July 1 Purchased merchandise from Boden Company...
-
Famighetti Company's income statement for the most recent year appears below: Sales (20,000 units)... Less: Variable expenses. Contribution margin.. Less: Fixed expenses.. Net operating loss.. 1. The...
-
During the month of June, Bon Voyage Travel recorded the following transactions: 1. Owners invested $25,000 in cash to start the business. They received common stock. 2. The month's rent of $500 was...
-
Write a program that uses a bag of strings to keep track of a list of chores you have to accomplish today. The user of the program can request several services: (1) Add an item to the list of chores;...
-
Write a program for keeping a course list for each student in a college. The information about each student should be kept in an object that contains the students name and a list of courses completed...
-
A balanced coin is tossed three times. Let x equal the number of heads observed. a. Use the formula for the binomial probability distribution to calculate the probabilities associated with x = 0, 1,...
-
What should McDonald's do to influence younger generations' behavior and get them back?
-
2 A sporting goods manufacturer requires yd of fabric 3 10 yd of material will make (Simplify your answer.) soccer shorts. to make a pair of soccer shorts. How many shorts can be made from 10 yd of...
-
wellbeing's strategic planning and marketing discuss wellbeing's SWOT ( S trengths, W eaknesses, O pportunities, and T hreats) analysis and use of the 4-p framework in their strategic marketing and...
-
A vapor cone, also known as shock collar or a shock egg, is a visible cloud of condensed water which can sometimes form around an object moving at high speed through moist air, for example an...
-
A car drives at a speed of 59.5 mph. After hitting the breaks, the car comes to a stop after driving 49.0 m. How much time did it take the car to stop, assuming the acceleration during breaking is...
-
Why are certain organizations either partially or completely exempt from Federal income tax?
-
Explain the regulation of the secretions of the small intestine.
-
Write and explain the C program for binary search with time complexity?
-
Explain the analysis of searching techniques with best, average and worst case.
-
Explain the algorithm for selection sort and give a suitable example.
-
Yi is collecting the Old Age Security pension benefit. Annually, Yi receives $5757 a year from OAS. In addition to OAS, Yi's annual income from her pension, CPP, and other sources totals $94250 a...
-
1. Write an equation that describes the information in the table: X Y -4 12 -2 3.5 2 -13.5 5 -26.25 2. Write an equation for the line in the graph below. Label the points on the graph that you used...
-
The inventory account is reduced by $36 to account for the returned defective items. what is the reason for this?
Study smarter with the SolutionInn App