Question: thank you for your time. the language is in java Write a program that asks the user to enter a sentence. Using matches method using

thank you for your time.  thank you for your time. the language is in java Write
a program that asks the user to enter a sentence. Using matches
the language is in java

Write a program that asks the user to enter a sentence. Using matches method using only one pattern validate that the entered sentence consists only of letters and ends with either: a period, an exclamation mark, or a question mark. To check if the given string represents a valid sentence define a pattern as shown in the Chapter 5 Lecture Notes. If it is not a valid sentence, your program should output that the input is not valid. Otherwise the input should be displayed with all the vowels replaced with an # character (see lecture notes for the example) The following shows sample runs of the program: Run #1 Please enter a sentence that consists of let ters only and ends with a period, an exclama tion mark, or a question mark The first sentence is not valid The entered input "The first sentence is not valid" is not a valid

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!