Class PrintLines
- java.lang.Object
-
- PrintLines
-
public class PrintLines extends java.lang.Object
A class that prints lines for a given actress from a script.The provided code is incomplete. Modify it so that it works properly and passes the unit tests in
PrintLinesTest.java
.- See Also:
- MP1 Documentation
-
-
Constructor Summary
Constructors Constructor Description PrintLines()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static void
linePrinter(java.lang.String actress, java.lang.String[] scriptLines)
Prints lines from a script for a given actress (or actor).static void
main(java.lang.String[] unused)
Solicits a single name from the user at the command line and searches for it in an excerpt from Rent (Rent-Excerpt.txt).
-
-
-
Method Detail
-
linePrinter
public static void linePrinter(java.lang.String actress, java.lang.String[] scriptLines)
Prints lines from a script for a given actress (or actor).Given a script formatted like "Rent-Excerpt.txt" and "Rent.txt", print all lines for a given actress in the following format. For example, if the search term is "Roger" or "roger":
roger --- This won't tune. --- Are you talking to me? --- I'm writing one great song -- ---
Etc. Here are the guidelines:
- You should print the name of the actress in all lowercase first on a single line. But only once.
- A character begins speaking when their name appears alone on a line capitalized
- A character stops speaking when you reach an empty line
- Groups of lines are separated by "---". Put another way, once another character begins speaking, print the "---" divider. Your output should also end with a "---".
- If you are asked to search for lines for an actress that does not exist, you should print nothing: not their name, not any "---" separators.
Complete the Javadoc comment and write this function.
- Parameters:
actress
- the actress to print lines forscriptLines
- the array of script lines to search through
-
main
public static void main(java.lang.String[] unused)
Solicits a single name from the user at the command line and searches for it in an excerpt from Rent (Rent-Excerpt.txt).You are free to review this function, but should not modify it. Note that this function is not tested by the test suite, as it is purely to aid your own interactive testing.
- Parameters:
unused
- unused input arguments
-
-