Lol i knew it heres one that is stummping me right now
File task9.java contains an incomplete program. Complete that program, by defining a count_occurrences function, and by modifying the existing most_frequent_character function, so as to satisfy the following specs:
Function count_occurrences takes two arguments, a string and a character. It returns the number of times the character occurs in the string.
Function most_frequent_character takes a string as an argument. It returns the character that occurs the most times in the string. If multiple characters tie for occurring the most times, the function can return any one of those characters tying for most occurrences.
IMPORTANT: you are NOT allowed to modify in any way the main function.
HINT: for every letter in the string, count how many times it occurs in the string. If it occurs more times than max_counter, then update max_counter and max_char.
This is an example run of the complete program:
Enter some text, or q to quit: hello world Most frequent character: 'l' Number of occurrences of 'l': 3 Enter some text, or q to quit: 786768hjk jkh89' Most frequent character: '8' Number of occurrences of '8': 3 Enter some text, or q to quit: Q Exiting...