Question: Hello, this is for programming one with the java language. This assignment is supposed to take an external file and find certain words and phrases

Hello, this is for programming one with the java language. This assignment is supposed to take an external file and find certain words and phrases and distinguish them from each other and return it as a state depending on what it was. There are three cases, a line could be a duck, a duckling, or neither. This code has to be done by scratch and again it has to take in an external file, thank you oh so very much for your help, seriously thank you.  Hello, this is for programming one with the java language. This

Program #2 : Calling a Duck a Duck! When I see a bird that walks like a duck and swims like a duck and quacks like a duck, I call that bird a duck Write a program to recognize a duck using the above criteria. More precisely, write a program to read lines of up to 80 characters and tell whether that line contains a duck. But ducks don't like to come out into the open, so you'll have to check if the line has the words Waddle", "Swim", and "Quack." The words can be in any order, in any case, and may be embedded in other words. There may not be characters embedded within them. As a special case, a line may have a duckling, if all occurrences of the words "Waddle", "Swim" and "Quack" are in lower case. HINT: Use nextLine to input each line into a string variable, and then use your indexOf operation to check for substrings. Sample Program Input (from infile.txt) I saw it waddling, swimming, and quacking It waddled, swimmed, and quacked My, SWIM, SWIM, SWIM, Wadd, lead on, quackers. Swim, swim, little moquackette, waddle home to mother. Aren't ducks silly? Sample Program Output (to screen) Line 1 is not a duck Line 2 is a duckling Line 3 is not a duck Line 4 is a duchk Line 5 is not a duck

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!