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
-
As the accountant for Jim?s Hardware, you have been asked tocom-plete a worksheet from the following trial balance as well asadditional data. Additional Data 1. Physical count of inventory on...
-
A survey of cross-border money transfers found that in 38% cases, the beneficiary account has suffered double charging, in contradiction to European Union rules. You randomly select 200 crossborder...
-
Use an Internet browser to search for the following terms: Electronic data interchange (EDI). Image-processing systems. Prepare a memo describing EDI and image- processing systems. Discuss the...
-
What replacement behavior could be taught to a student as part of a behavior intervention plan and what type of generalization could be used to help the student apply that behavior to a different...
-
Mr B aged 52 years, has earned rupees 75,00,000 out of his business. His ex-wife gifted him a car worth rupees 8 lakh. He spent a total of rupees 20 lakh during a family trip. He won a lottery of 16...
-
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...
-
In no more than three PowerPoint slides, list some general guidelines that a taxpayer can use to determine whether it has an obligation to file an income tax return with a particular state. (Include...
-
How is cooperative advertising used in magazines?
-
What is the difference between an emotional and a rational copy tone of voice? What factors determine choice?
-
What is the difference between traditional advertising and interactive advertising?
-
How can newspaper be made more interactive and engaging?
-
Why are the Internet and social media important aspects of direct marketing?
-
Elaine Case (single with no dependents) has the following transactions in 2016: AGI (exclusive of capital gains and losses) .....................$240,000 Long-term capital...
-
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.
-
Assume that a firm has weighted average cost of capital of 3.6% with a corporate tax rate of 21%. The pre-tax cost of debt is 3.1%. In case the firm would have no debt, the cost of equity for the...
-
Consider the stock of Aya Company, which will pay an annual dividend of $3 one year from today. The dividend will grow at a constant rate of 3%, forever.The market requires a 12% return on the...
-
Analyze the video presented on the link below. Also, please discuss or explain the video and relate it to personal finance. https://www.youtube.com/watch?v=nFY0HBkUm8o
Study smarter with the SolutionInn App