Question
WRITE IN JAVA Project 3: LetterFinderAA.java Write a program that will ask the user to input a phrase (multiple words) and a letter. You will
WRITE IN JAVA
Project 3: LetterFinderAA.java
Write a program that will ask the user to input a phrase (multiple words) and a letter. You will tell them at which index their chosen letter can be found in their sentence. This task needs to be set up in a static method. Create the method so that it takes the sentence and the letter as input parameters and will return an integer. For example, if the sentence is Hello Cat and the users letter is o, your method should return 4. Your static method should not do any inputting or outputting. That part should be in your main method. You should allow the user to enter new sentences and letters until they chose to be done. Set it up so that if they type done as their sentence, the program ends. Also, you should inform the user if the character that theyve entered does not exist in the sentence. See below.
Output Example (User input is marked with >>>. Everything else is what you print to the screen.)
This program will tell you where a certain character is in a sentence. Please enter a sentence. (Type the word done to exit.)
>>> Dogs drool.
Please enter the letter youd like to find:
>>> l
That character is located at index 9.
This program will tell you where a certain character is in a sentence. Please enter a sentence. (Type the word done to exit.)
>>> I love pizza.
Please enter the letter youd like to find:
>>> X
That character is not present in your sentence.
This program will tell you where a certain character is in a sentence. Please enter a sentence. (Type the word done to exit.)
>>> done
Goodbye.
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