From d71925a46b5ab96c14e3481c58f0dcba786fcc0a Mon Sep 17 00:00:00 2001 From: Chris Date: Mon, 23 Jan 2017 13:16:41 -0800 Subject: [PATCH 1/2] Shortened it as it was too long in C6 --- README.md | 51 +++++++++++++++++++++++++-------------------------- 1 file changed, 25 insertions(+), 26 deletions(-) diff --git a/README.md b/README.md index 92424be..3f92705 100644 --- a/README.md +++ b/README.md @@ -47,44 +47,43 @@ What's the Data Type of the following? ### Assignment: Requirements 1. Replace lines 36 and 37 and write a loop to print out each day and the emoticon that is associated by analyzing the mood of that day. -Your result will look like: -``` -03/01 :-( -03/13 :-| -... -``` + Your result will look like: + ``` + 03/01 :-( + 03/13 :-| + ... + ``` -**think**: Why does 03/13 come out as _neutral_ when it should be _happy_? How could we fix this? + **think**: Why does 03/13 come out as _neutral_ when it should be _happy_? How could we fix this? 2. To make the results a little more accurate, let's write and utilize a method called `strip_punctuation` to strip out the punctuation that affects the results. Namely, remove exclamation marks (!), periods (.), commas (,), and hashtags (#). -Your method should take a string as an argument and return the string without the above mentioned punctuation. + Your method should take a string as an argument and return the string without the above mentioned punctuation. -After writing this method, our new result should be: -``` -03/01 :-( -03/13 :-) + After writing this method, our new result should be: + ``` + 03/01 :-( + 03/13 :-) ... ``` + **think**: Where should we call `strip_punctuation`? Does it matter? Why? -**think**: Where should we call `strip_punctuation`? Does it matter? Why? -3. Write a method called `happy_days` to determine how many logged entries it takes until there have been three :-) happy days. +## Optional Enhancements -Your output could be something like: -``` -It takes 5 entries for 3 happy days to occur -``` -**think**: What are you going to do if there aren't at least 3 happy days? Where do you need to handle that case? +1. Write a method called `happy_days` to determine how many logged entries it takes until there have been three :-) happy days. -4. Write a method called `overall_mood` to determine the most common mood across all logged entries. + Your output could be something like: + ``` + It takes 5 entries for 3 happy days to occur + ``` -Your output could be something like: -``` -The most common mood is :-) -``` + **think**: What are you going to do if there aren't at least 3 happy days? Where do you need to handle that case? -**think**: Should you use an array or a hash to solve this problem? Why? +2. Write a method called `overall_mood` to determine the most common mood across all logged entries. -**think**: What if we eventually want to add feelings to our analysis? Can we write this code in a way that will prevent us from having to re-write it later? + Your output could be something like: + ``` + The most common mood is :-) + ``` From b91302e904bbfda4ad60fdbe7eacfe1fe9e3a427 Mon Sep 17 00:00:00 2001 From: Chris Date: Tue, 24 Jan 2017 10:27:38 -0800 Subject: [PATCH 2/2] Added test & verify --- README.md | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 3f92705..d96f40d 100644 --- a/README.md +++ b/README.md @@ -54,6 +54,9 @@ What's the Data Type of the following? ... ``` + #### Test & Verify + Run the resulting code & ensure that each day is printed with the correct emoticon. **think** which does should be happy, which sad and which + **think**: Why does 03/13 come out as _neutral_ when it should be _happy_? How could we fix this? 2. To make the results a little more accurate, let's write and utilize a method called `strip_punctuation` to strip out the punctuation that affects the results. Namely, remove exclamation marks (!), periods (.), commas (,), and hashtags (#). @@ -64,8 +67,13 @@ What's the Data Type of the following? ``` 03/01 :-( 03/13 :-) -... -``` + ... + ``` + + #### Test & Verify + Run the resulting code & check to see if days where there is punctuation change. You can also put test `puts` messages in your code to verify that your method is removing punctuation. + + **think**: Where should we call `strip_punctuation`? Does it matter? Why?