In Java Write a program that counts the number of occurrences of lowercase and uppercase vowels in entered lines of text. Use a two-dimensional array to store the vowel counts. The array’s first column holds the counts for the lowercase vowels, and the second column holds the counts for the uppercase vowels. The user indicates the end of the input by pressing enter by itself. At that point, your program should print, for each vowel, the total number of lowercase occurrences, the total number of uppercase occurrences, and the total number of combined occurrences. Here are some implementation requirements: 1. Use two separate files – one for a main driver method and one for a VowelCounter class that keeps track of vowel counts. 2. main – Repeatedly prompt the user to enter a line of text or press enter by itself to quit. Note that the stdIn.nextLine() method returns the empty string ("") if the user presses enter by itself. For each entered line of text, call the processLine method. When the user chooses to quit, call printSummary. 3. Within the VowelCounter class, include these methods: o processLine ─ This method receives a line of text as a parameter and uses it to update the vowel counts appropriately. o printSummary ─ This method prints a summary of the counts for all vowels entered. Sample session: Enter a line of characters (press enter by itself to quit): Oscar the ostrich graduated Enter a line of characters (press enter by itself to quit): from Exeter in England. Enter a line of characters (press enter by itself to quit): A: 4 lowercase, 0 uppercase, 4 total E: 4 lowercase, 2 uppercase, 6 total I: 2 lowercase, 0 uppercase, 2 total O: 2 lowercase, 1 uppercase, 3 total U: 1 lowercase, 0 uppercase, 1 total

EBK JAVA PROGRAMMING
9th Edition
ISBN:9781337671385
Author:FARRELL
Publisher:FARRELL
Chapter8: Arrays
Section: Chapter Questions
Problem 9PE
icon
Related questions
Question

In Java

Write a program that counts the number of occurrences of lowercase and uppercase vowels in
entered lines of text. Use a two-dimensional array to store the vowel counts. The array’s first
column holds the counts for the lowercase vowels, and the second column holds the counts for
the uppercase vowels.
The user indicates the end of the input by pressing enter by itself. At that point, your program
should print, for each vowel, the total number of lowercase occurrences, the total number of
uppercase occurrences, and the total number of combined occurrences.
Here are some implementation requirements:
1. Use two separate files – one for a main driver method and one for a VowelCounter class
that keeps track of vowel counts.
2. main – Repeatedly prompt the user to enter a line of text or press enter by itself to quit.
Note that the stdIn.nextLine() method returns the empty string ("") if the user presses
enter by itself. For each entered line of text, call the processLine method. When the user
chooses to quit, call printSummary.
3. Within the VowelCounter class, include these methods:
o processLine ─ This method receives a line of text as a parameter and uses it to
update the vowel counts appropriately.
o printSummary ─ This method prints a summary of the counts for all vowels
entered.
Sample session:
Enter a line of characters (press enter by itself to quit):
Oscar the ostrich graduated
Enter a line of characters (press enter by itself to quit):
from Exeter in England.
Enter a line of characters (press enter by itself to quit):
A: 4 lowercase, 0 uppercase, 4 total
E: 4 lowercase, 2 uppercase, 6 total
I: 2 lowercase, 0 uppercase, 2 total
O: 2 lowercase, 1 uppercase, 3 total
U: 1 lowercase, 0 uppercase, 1 total

Expert Solution
Step 1

The algorithm of the code:-

1. Create a Scanner class object to read the data.
2. Create an object of VowelCounter class.
3. Repeat forever until a new line is entered.
4. Read a line of characters from the user.
5. Pass the line of characters to the processLine() method of vowel counter.
6. Process the line of characters and update the counts in the vowel count array.
7. If a new line is entered, print the summary and break it from the loop.

trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 6 steps with 4 images

Blurred answer
Knowledge Booster
Arrays
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
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT