Question: Write a Java module called simplematch.java that contains a recursive function called 'match(String pattern, String word)', that can be used to determine if a

Write a Java module called simplematch.java that contains a recursive function called'match(String pattern, String word)', that can be used to determine if a

Write a Java module called simplematch.java that contains a recursive function called 'match(String pattern, String word)', that can be used to determine if a given pattern matches a given word. A pattern consists of letters and '?' wildcards. A '?' wildcard matches any letter at the corresponding position in the word. On the Vula page for this assignment you will find a program called testsimple.java that you can use to check your function. (The automatic marker will use this.) Sample I/O: Enter a pattern (or 'q' to quit): 1?ad Enter a word lead It's a match. Enter a pattern: le?d Enter a word led They don't match. Enter a pattern (or 'q' to quit): 1??d Enter a word lend It's a match. Enter a pattern (or 'q' to quit): q HINTS: I can think of three base cases. One is when both strings are empty. Another is when one is empty and the other is not. And the third is ... The palindrome function makes progress by 'eating' the characters at the ends of the string. This function makes progress by eating the first letter of each string.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

Here is the implementation of the simplematch module in Java java public class simplematch public st... View full answer

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 Programming Questions!