Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Assignment 2 Overview In this assignment you will write a program that will accept a string and a search term from the user. Your program

image text in transcribed
image text in transcribed
Assignment 2 Overview In this assignment you will write a program that will accept a string and a search term from the user. Your program will then ask the user if they want to consider spaces and if upper and lower case should be considered as different. All of these will be accepted as strings and int values will be parsed as needed. It then tells the user if the search term is in the string or not, ignoring spaces and case as asked, and where the term was in the string. Requirements Your program must do the following in order to receive full credit on this assignment. 1. Accept two string values from the user a. The first is the original string to search through. b. The second is the substring we will be searching the first string for. 2. Ask the user if they want to consider spaces in the two strings. a. Ask the user to type a number for Yes (like 1) and a second number for No. b. This must be pulled from the Scanner as a String! 3. Ask the user if they want to consider differences between upper and lower case in the two strings a. Again, ask for a number b. Again, this must be taken in as a String 4. Convert the two number inputs into their int values and store them in new int variables b. You can also assume that they typed in one of the numbers that you asked for. If the user asked you to not consider spaces, remove them from both the original string and the search term. 5. a. Hint: Remember that replace allows you to replace with a blank string. 6. If the user asked you to not consider case, convert both the original string and search term strings to the same case. a. You might want to just use equalsIgnoreCase, but some of the comparisons we will be making cannot ignore the case, so we must set it all to the same case in order to avoid that

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Modern Database Management

Authors: Jeffrey A. Hoffer Fred R. McFadden

9th Edition

ISBN: B01JXPZ7AK, 9780805360479

More Books

Students also viewed these Databases questions

Question

Explain the five steps of Monroes Motivated Sequence

Answered: 1 week ago

Question

Finding and scheduling appointments with new prospective clients.

Answered: 1 week ago