Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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.
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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started