Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a program that Receives a paragraph from the user and stores it in String paragraph. Prompts the user to Enter the search phrase:, and

Write a program that

  1. Receives a paragraph from the user and stores it in String paragraph.
  2. Prompts the user to "Enter the search phrase:", and stores the input in a String text.
  3. Searches (case-sensitive) the paragraph for the text and prints the results, and prints the number of appearances and the index of every appearance as below (assuming that the text has appeared only three times):
Search phrase: "[text]" 1. [index of the first appearance] 2. [index of the second appearance] 3. [index of the third appearance] 
  1. Keeps getting text and printing the result until the user enters "exit". When the user enters "exit", the program prints "End!", and stops.

import java.util.Scanner;

public class Main { public static void main(String[] args) { Scanner scnr = new Scanner(System.in); /* Type your code here. */ } }

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

Relational Database And Transact SQL

Authors: Lucy Scott

1st Edition

1974679985, 978-1974679980

More Books

Students also viewed these Databases questions