Question: Write a method a program Lab05_01_Q1_lastname.java that contains two methods called ruleChecker and containsLetter. 1. The method containsLetter (String s, char c) checks whether or

 Write a method a program Lab05_01_Q1_lastname.java that contains two methods called

Write a method a program Lab05_01_Q1_lastname.java that contains two methods called ruleChecker and containsLetter. 1. The method containsLetter (String s, char c) checks whether or not the string s includes o. (Don't use similar methods in Java library). 2. The ruleChecker method gets an input of string type and checks whether it conforms to a special rule or not. The method returns -1, if the input string obeys a rule (see below). Otherwise, it returns the index of the first word in which the rule is violated. The method should use the containsLetter method to check whether a given String contains the given letter. The rule is defined as follows: The word in the text must contain (i % 26) letter of the alphabet. For example the following text conforms to the rule: zeroth letter a is in the zeroth word, A bear can discover precious food disguised beneath ice. Any butcher certainly needs meat freezer. The following sentence does not follow the rule: A beautifully crafted diamond necklace for girl was gifted by the groom. rightarrow rule violated in the 7^th word. (Start counting from 0)

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!