Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Starting Code: /* Programmer: Date: Project: Lab 3.5 RemovePhrase File Name: RemovePhrase.java Program Description: Removes a given phrase every time it is appears in a

image text in transcribed
Starting Code:
/* Programmer:
Date:
Project: Lab 3.5 RemovePhrase
File Name: RemovePhrase.java
Program Description: Removes a given phrase every time it is appears in a sentence.
*/
import java.util.*;
public class RemovePhrase{
public static void main( String[] args ){
Scanner keyboard = new Scanner( System.in );
}
}
Lab 3.5-RemovePhrase The goal of this lab is to remove a specific phrase every time it occurs in a sentence. To complete this lab, write a class called RemovePhrase that completes the following tasks. 1. Prompt the user to enter two Strings. One String will contain a sentence. The other String will contain the phrase the user wants to remove from the sentence. Use the nextLine0 method of the Scanner class to receive the user's input values. 2. Use a loop to repeat the following: a. Determine if the phrase appears in the sentence b. Remove the phrase from the sentence. 3. Print the sentence with the phrase removed every time it occurs in the original sentence Below are example outputs for your program sentence "The hero won. phrase "he Output: T ro won sentence "mississippi; phrase ir Output: msssspp sentence # "mississippi". phrase = "s"; Output: miippi sentence "In a battle of cats, the wildcats beat the bobcats 24 10. My cat was happy with the outcome.: phrase "cats

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

The Structure Of The Relational Database Model

Authors: Jan Paredaens ,Paul De Bra ,Marc Gyssens ,Dirk Van Gucht

1st Edition

3642699588, 978-3642699580

More Books

Students also viewed these Databases questions