MP2: FindLineScript

Learning Objectivies

Introduction

This program reads a movie script and searches for the line(s) with the given text. When the program starts, it asks you to enter the words to search for. The program reads one line at a time. If the line contains the search phrase, it prints the current line number and the line. See the example output below, noting that the test is case insensitive.

Clarification

Example Output

Example Output #1(User input is 'spoon\n'):

Searching for 'spoon'
12 - blocks.  A skinny BOY holds a SPOON which sways like a
17 - The Boy smiles as Neo picks up a spoon and tries to
21 - SPOON BOY
22 - Your spoon does not bend because
23 - it is just that, a spoon.  Mine
24 - bends because there is no spoon,
29 - SPOON BOY
30 - Link yourself to the spoon.
31 - Become the spoon and bend
34 - Neo nods, again holding up his spoon.
37 - There is no spoon.  Right.
39 - He concentrates.  The spoon begins to bend just as the
45 - Spoon Boy smiles.
Done Searching for 'spoon'

Example Output #2 (User input is 'cookie a')

Searching for 'cookie a'
Done Searching for 'cookie a'

Example Output #3 (User input is 'a cookie')

Searching for 'a cookie'
215 - You better take a cookie.  Got a
218 - He eyes her, then takes a cookie.
Done Searching for 'a cookie'