Programming - Vowels in Baby Names
Introduction
In the final exam for the Fundamentals of Programming course in the fall I asked you to write code that worked with a large file of baby names. It was divided into two parts
First, create a function called countVowels(). This function should:
- Take in one string as a parameter
- Return a single integer indicating the number of vowels (including y) in the string.
- It should work with both upper-case and lower-case letters.
Second, create a function called nameAnalysis() This function should:
- Take in two parameters
- the name of a file to analyze
- the string "boy" or "girl"
- The function should calculate the average number of vowels in the names in the file for the gender provided as the second parameter.
- It should print a final, well-formatted, message at the end about the average number of vowels in names for each gender.
- Returns nothing. The results of this are displayed in the print statement.
In order to get us back in the mindset of programming again I want to work together to write the code that solves each of these elements. But, the challenge is that I'm not meeting with you face to face (or screen to screen) so we can't work through this together. Fortunately, I worked with my undergraduates in class on Friday, January 28 on this exact project. I don't know how much of this the microphone will pick up, but here is the recording of what we did together to refresh programming.
- Panopto Recording
In class materials
You will need the following data files