Menu

[Solved]Java Implement Countnotmatching Method Takes Input String Character Returns Many Character Q37074696

Java.

Implement thecountNotMatching method below, which takes asinput a string and a character and returns how many characters inthe string are NOT the supplied character. An examplemain method, as well as corresponding output, issupplied – you cannot change this method, and the output when theprogram is run must conform exactly to the sample output.

/* sample run:

Other characters: 1

Other characters: 3

Other characters: 3

*/

public static void main(String args[]) {

   System.out.printf(“Other characters: %d%n”,countNotMatching(“Foo”, ‘o’));

   System.out.printf(“Other characters: %d%n”,countNotMatching(“Bar”, ‘b’));

  System.out.printf(“Other characters: %d%n”,countNotMatching(“Baz!”, ‘B’));

}

// put your countNotMatching method here

Expert Answer


Answer to Java. Implement the countNotMatching method below, which takes as input a string and a character and returns how many ch… . . .

OR


Leave a Reply

Your email address will not be published. Required fields are marked *