Answered step by step
Verified Expert Solution
Question
1 Approved Answer
PLEASE READ BEFORE PROCEED !! THANK YOU (programming in JAVA). Assignment Description This assignment will provide you with practice with String and file processing. Recall
PLEASE READ BEFORE PROCEED !! THANK YOU (programming in JAVA).
Assignment Description This assignment will provide you with practice with String and file processing. Recall the text from this classic scene from Jaws ELLEN: Do you see the kids? BRODY: Probably out in the back yard. ELLEN: In Amity, you say 'Yahd.' (she gives it the Boston sound) BRODY: The kids are in the yahd, playing near the cah. How's that sound? ELLEN: Like you're from N'Yawk. (If you don't recall, or if you've never seen the movie, stop reading and watch it immediately. It's one of the best movies of all time.) In this assignment, you'll help Brody sound like he's from Amity by writing a program that reads in the text of the movie's script, and transforms it so that it when read, the speaker would have a South Boston (or Southie) accent. Save a copy of the Jaws script to a local directory, and write a program that behaves as follows: Read the script from the file. Convert the text to its equivalent in a Southie accent. Write the converted text to the output file. The Southie Accent Handling all of the exceptions and idiosyncracies of language is difficult, so for this assignment we will use a few simple rules to approximate the accent. Basic Rules (10 points each) If there's an '' following a vowel ('a', 'e', i', 'o', or 'u'), replace 'r with 'h'. For example, " left my car keys by the harbor" becomes "I left my cah keys by the hahboh." If a word ends in 'a', append an 'r'. For example "tuna" becomes "tunar", "Cuba" becomes "Cubar", and "idea" becomes "idear". (Don't change this to an 'h' based on the previous rule; leave it as an 'r'.) Do not apply this rule to the word "a", so "a tuna" should become "a tunar", not "ar tunar". . Replace the word "very" with the word "wicked". So "very hard" becomes "wicked hahd". Exceptions (10 points each) If 'r is at the end of a word and is preceded by "ee" or 'i' replace 'r' with "yah" instead of 'h'. For example, "deer" becomes "deeyah" instead of "deeh", but "veneers" still becomes "veneehs". If 'r is at the end of a word and is preceded by "oo", replace 'r' with "wah". For example, "door" becomes "doowah" instead of "dooh" (but "doors" still becomes "doohs") Your program should be able to recognize these rules and their exceptions whether the letters are upper- or lower case, however, the output is not required to match the case of the input exactly. For example, if your program reads the word "doOr", it's ok if it outputs "doowah". It does not have to output "doOwah", though you are free to add this feature for extra credit. Input and Output (10 points) Your program will read take it input from a file using scanner, and will write its output using Printstream, just as we've done in class. You are not required to handle exceptions, but remember that for any method you write that uses File, you'll need to add throws FileNotFoundException to the top of the method definition Suggestions Don't try to program everything all at once. Do it in parts. First make sure that you can read and write from files. As a first pass, you might try just copying everything from the input to output file without converting anything. Try to break the rest of the program down into manageable parts, and implement each part as a method. For instance, you might create a method that is passed a single word as an argument, and returns the word converted into a Boston accent. This is a relatively big task, so the method should call other methods to help. Perhaps you might write one for each of the 5 rules. You might also write a method which is passed a string consisting of several words, i.e., a sentence or paragraph, and returns a new string, which is just like the original, but converted into a Boston accent. (It could do this by calling the previous method repeatedly.) Other helpful methods would be ones to find the beginning and ending of quotes (if you're attempting this extra credit option), and an isVowel method, that takes a char value as argument, and returns true if the char is a vowel. probably is too complicated and does too much. Make it shorter String methods If you find something useful, you're welcome to use any of the methods in Java's String class, even if you find some that we have not covered in class or are mentioned in the textbook. (In my own implementation, I have not used any methods in the Java API that we haven't used in class.) Assignment Description This assignment will provide you with practice with String and file processing. Recall the text from this classic scene from Jaws ELLEN: Do you see the kids? BRODY: Probably out in the back yard. ELLEN: In Amity, you say 'Yahd.' (she gives it the Boston sound) BRODY: The kids are in the yahd, playing near the cah. How's that sound? ELLEN: Like you're from N'Yawk. (If you don't recall, or if you've never seen the movie, stop reading and watch it immediately. It's one of the best movies of all time.) In this assignment, you'll help Brody sound like he's from Amity by writing a program that reads in the text of the movie's script, and transforms it so that it when read, the speaker would have a South Boston (or Southie) accent. Save a copy of the Jaws script to a local directory, and write a program that behaves as follows: Read the script from the file. Convert the text to its equivalent in a Southie accent. Write the converted text to the output file. The Southie Accent Handling all of the exceptions and idiosyncracies of language is difficult, so for this assignment we will use a few simple rules to approximate the accent. Basic Rules (10 points each) If there's an '' following a vowel ('a', 'e', i', 'o', or 'u'), replace 'r with 'h'. For example, " left my car keys by the harbor" becomes "I left my cah keys by the hahboh." If a word ends in 'a', append an 'r'. For example "tuna" becomes "tunar", "Cuba" becomes "Cubar", and "idea" becomes "idear". (Don't change this to an 'h' based on the previous rule; leave it as an 'r'.) Do not apply this rule to the word "a", so "a tuna" should become "a tunar", not "ar tunar". . Replace the word "very" with the word "wicked". So "very hard" becomes "wicked hahd". Exceptions (10 points each) If 'r is at the end of a word and is preceded by "ee" or 'i' replace 'r' with "yah" instead of 'h'. For example, "deer" becomes "deeyah" instead of "deeh", but "veneers" still becomes "veneehs". If 'r is at the end of a word and is preceded by "oo", replace 'r' with "wah". For example, "door" becomes "doowah" instead of "dooh" (but "doors" still becomes "doohs") Your program should be able to recognize these rules and their exceptions whether the letters are upper- or lower case, however, the output is not required to match the case of the input exactly. For example, if your program reads the word "doOr", it's ok if it outputs "doowah". It does not have to output "doOwah", though you are free to add this feature for extra credit. Input and Output (10 points) Your program will read take it input from a file using scanner, and will write its output using Printstream, just as we've done in class. You are not required to handle exceptions, but remember that for any method you write that uses File, you'll need to add throws FileNotFoundException to the top of the method definition Suggestions Don't try to program everything all at once. Do it in parts. First make sure that you can read and write from files. As a first pass, you might try just copying everything from the input to output file without converting anything. Try to break the rest of the program down into manageable parts, and implement each part as a method. For instance, you might create a method that is passed a single word as an argument, and returns the word converted into a Boston accent. This is a relatively big task, so the method should call other methods to help. Perhaps you might write one for each of the 5 rules. You might also write a method which is passed a string consisting of several words, i.e., a sentence or paragraph, and returns a new string, which is just like the original, but converted into a Boston accent. (It could do this by calling the previous method repeatedly.) Other helpful methods would be ones to find the beginning and ending of quotes (if you're attempting this extra credit option), and an isVowel method, that takes a char value as argument, and returns true if the char is a vowel. probably is too complicated and does too much. Make it shorter String methods If you find something useful, you're welcome to use any of the methods in Java's String class, even if you find some that we have not covered in class or are mentioned in the textbook. (In my own implementation, I have not used any methods in the Java API that we haven't used in class.)Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started