countLetter

Category: Programming
Author: Brett Wortzman
Book Chapter: 6.2
Problem: countLetter
(a) (9 points) Write a static method named countLetter that takes two parameters, a char and a String, and returns the number of times the given character appears in the given string. Your method should perform a case-sensitive comparison (i.e. "a" and "A" are not the same character).

(b) (12 points) Using countLetter, write a static method named password that takes two parameters: a char and an int. The method should repeatedly prompt the user to enter a word until the user types a word that contains at least the given number of the given character. Each time the user types a word that does not contain enough of the given letter you should print out how many more of the letter must be included to the console. The method should return the total number of characters typed by the user. If the integer passed is less than 1, the method should return after the first user input, regardless of what is typed.