Data structure & Algorithum Java program Write code that accomplishes the following tasks: Consider two bags that can hold strings. One bag is name letters and contain several one-letter strings. The other bag is empty and is named vowels. One at a time, remove a string from letters. If the strings contain a vowel, place it into the bag vowels; otherwise, discard the string. After you have checked all of the strings in letters, report the number of vowels in the bag vowels and the number of times each vowel appears in the bag. 1. Declare and initialize Bag object named letters. 2. Add several one-letter strings to letter object 3. Declare and initialize another Bag object vowels. 4. Removed a atring from the letters object 5. If the removed string is a vowel, add that vowel to the vowel Bag object. 6. Repeat removed and vowel check for entire Bag. 7. Display the number of vowels in the Bag. 8. Display the frequency of occurrences each vowel appears.

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter7: User-defined Simple Data Types, Namespaces, And The String Type
Section: Chapter Questions
Problem 3PE
icon
Related questions
Question

Data structure & Algorithum Java program

Write code that accomplishes the following tasks: Consider two bags that can hold strings. One bag is name letters and contain several one-letter strings. The other bag is empty and is named vowels. One at a time, remove a string from letters. If the strings contain a vowel, place it into the bag vowels; otherwise, discard the string. After you have checked all of the strings in letters, report the number of vowels in the bag vowels and the number of times each vowel appears in the bag.

1. Declare and initialize Bag object named letters.
2. Add several one-letter strings to letter object
3. Declare and initialize another Bag object vowels.
4. Removed a atring from the letters object
5. If the removed string is a vowel, add that vowel to the vowel Bag object.
6. Repeat removed and vowel check for entire Bag.
7. Display the number of vowels in the Bag.
8. Display the frequency of occurrences each vowel appears. 

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 4 images

Blurred answer
Knowledge Booster
Problems on Dynamic Programming
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT