Question: Urgent Java 1 help. Please don't make code overly complex. Write a program that prompts the user for a sentence and then calculates the total

Urgent Java 1 help. Please don't make code overly complex.

  • Write a program that prompts the user for a sentence and then calculates the total number of vowels and the total number of capital letters in the sentence, and reports if there are any numerical digits in the sentence.
  • Save your program as VowCapDig.java.
  • The program should run using an indefinite loop (of your choice) to allow the user to enter as many sentences as desired.
  • The program must contain the following methods (in addition to main):

Vowel Counter:

  • This method must be named vowelCounter
  • It takes a String parameter
  • It returns an int for the total number of vowels (A, E, I, O, U, a, e, i, o, u) contained in the String

Capital Counter:

  • This method must be named capitalCounter
  • It takes a String parameter
  • It returns an int for the total number of capital letters contained in the String

Contains Digit:

  • This method must be named containsDigit
  • It takes a String parameter
  • It returns a boolean for whether there are any numerical digits (0-9) contained in the String
  • Hint: all of these methods should use a for loop to iterate the String searching for vowels, capital letters or digits
  • Recall that you can use an if statement with <= and >= to compare characters
  • Also, the Unicode (Links to an external site.) table may be helpful here. Note that the digits fall within a defined range of Unicode values. Capital letters also fall within a defined range of Unicode values.
  • Write your indefinite loop in main and call your methods inside of this indefinite loop.
  • Note the " around the q in the prompt.
  • Your program must work identically to the sample output below for full credit.

Sample Output:

Welcome!

Enter a sentence or "q" to quit: Power to the people! There are 7 vowel(s) in the sentence.

There are 1 capital letter(s).

The sentence does not contain digits.

Enter a sentence or "q" to quit: 256 E. Elm St, San Jose There are 5 vowel(s) in the sentence.

There are 5 capital letter(s).

The sentence does contain digits.

Enter a sentence or "q" to quit: Eleanor Roosevelt

There are 8 vowel(s) in the sentence.

There are 2 capital letter(s).

The sentence does not contain digits.

Enter a sentence or "q" to quit: q Goodbye!

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!