Answered step by step
Verified Expert Solution
Link Copied!

Question

00
1 Approved Answer

Please provide the code in Java (And with extra credit please!) CIS 1068 Assignment 6 Southie Styles Due: Friday, March 15 60 points Assignment Description

image text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribed

Please provide the code in Java (And with extra credit please!)

CIS 1068 Assignment 6 Southie Styles Due: Friday, March 15 60 points 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. Your Job Save a copy of the laws 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 'r' following a vowel (a', 'e', i', 'o, or'u'), replace'r' with 'h. For example, "I left my car keys by the harbor" becomes "I left my cah keys by the hahboh." . .If a word ends in 'a', append an '. 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 ' is at the end of a word and is preceded by "ee" or 'i replace ' 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 "", replace with "wah". For example, "door" becomes "doowah" instead of "dooh" (but "doors" still becomes "d 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, j 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 If you're writing a method that does so much that you can't think of how you'd possibly test it, the method is 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.) Where to Put Your Text Files We've read and written to files, however, when reading from relative paths using an IDE there are so many different folders and files in your project folder, the question becomes, "relative to what? If we look in the upper-right hand corner of eclipse in the Package Explorer, we see something like this: Package Explorer 3 SomePracticeStringMethods SomePracticeStringMethodsFinish G SouthieStyles JRE System Library [JavaSE-1; src cis 1 068. southe SouthieStyles.java SouthieStylesTest.java JUnit 5 StupidMath If we navigate to our operating system's file manager (for example, Windows Explorer on Windows or Finder on a Mac) to the folder where jaws.txt is stored, and drag the file onto eclipse's project folder (the SouthieStyles folder in the previous picture), the file is copied into our project folder, and can be accessed simply within our project using just the file's name. Eclipse's project view would then look something like this: SouthieStyles JRE System Library [JavaSE-1. sr Ecis1068.southie SouthieStyles.java SouthieStylesTest.java JUnit 5 jaws.txt Scanner We've used Scanner to read text from the user at the keyboard, but it's much more versatile. Scanners actually read and parse text from any source. In this assignment, you might find it useful to attach a Scanner to read an parse Strings. Here are some examples: This program attaches a Scanner to a String, and reads it word-by-word import java.util.Scanner; public class AttachScannerToString

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered 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

Students also viewed these Databases questions