In the following questions you will be asked to write multiple functions doing each a specific task. The signature of each function will be provided as well as a main() function that calls all the functions one by one and print their results to the screen.
Question 1 (20 pts) Write a function that asks the user to input a sentence, then it will ask the user to enter one letter. The function will then count the number of occurrences of this letter in the provided sentence. Don't forget that both uppercase and lowercase letters should be counted. Signature of the function: void countLetter();
When running the CountLetter() function, the output should be similar to the following example:
Please enter a sentence: HELLO there, how are you?
Please enter a letter: o
The letter o is repeated 3 times in your sentence
Question 2 (20 pts) According to wikipedia: The 26 code words in the NATO phonetic alphabet are assigned to the 26 letters of the English alphabet in alphabetical order as follows: Alfa, Bravo, Charlie,
Write a function that takes a word and translate each letter into its corresponding phonetic alphabet.
Signature of the function: void convertPhonetic();
When running the ConvertPhonetic() function, the output should be similar to the following example:
Please enter a word: Hello
Hotel Echo Lima Lima Oscar
Question 3 (20 pts) ● Research tail recursivity and explain in your own words why it is better to design your recursive function this way.
● Can any recursive function be designed to be tail recursive? Please develop your answer by providing clear explanation
Write your answer inside a C++ comment block within your cpp file.
Question 4 (20 pts) Write a tail recursive factorial function. Signature of the function: void factorial();
When running the factorial() function, the output should be similar to the following example:
Please enter a number: 4
The factorial of 4 is 24
Please note that you may need to write a helper function to be called by factorial to make your code easier.
Question 5 (20 pts) Write an enhanced version of your recursive factorial function using an array that stores the calculated factorial of the first 6 factorials. This means that the values for the first 6 factorials (1, 2, 6, 24, 120, 720) are already known and stored in an array so you don’t need to recalculate them each time the function runs. Signature of the function: void enhancedFactorial();
When running the factorial() function, the output should be similar to the following example:
Please enter a number: 4
The factorial of 4 is 24
Please note that you may need to write a helper function to be called by factorial to make your code easier.
Please use the following main() function for testing: int main() { countLetter(); convertPhonetic(); factorial(); enhancedFactorial(); return 0;