Think Pair Share 3
- Due Sep 15, 2020 by 10am
- Points 1
- Submitting a file upload
- Available after Sep 14, 2020 at 10am
Think
Insert a new row just below the header in the table in your TPS Google Doc. Fill in the first two columns. Place your response to the following in the "Think" column:
Consider the following program that converts human years to dog years. If the user enters their age as 18, it should display "You are 85 in dog years." (using the formula Links to an external site. 10.5 dog years for the first two human years, then 4 dog years per human year thereafter). However, it prints "You are 84 in dog years". Identify why that happens and how to fix it.
#include <iostream>
using namespace std;
int main()
{
const int FIRST_TWO_YEARS_FACTOR = 10.5;
const int REMAINING_YEARS_FACTOR = 4;
int humanAge;
cout << "How old are you (must be at least 2)?" << endl << "> ";
cin >> humanAge;
cout << "You are "
<< FIRST_TWO_YEARS_FACTOR*2 + (humanAge-2)*REMAINING_YEARS_FACTOR
<< " in dog years." << endl;
return 0;
}
Pair
If you are joining the class live (in person or over Zoom), pair up with someone when asked to do so—please use Discord or your preferred means of interacting with someone to share your answers (please see the announcement with details about Discord). Settle on an answer between to two or three of you and put that answer down in your "Pair" column.
Share
Regardless of whether or not you are attending live, one person from your pair group should add your answer to the "TPS class share Links to an external site." document.
Submit
Finally, submit your personal TPS Google doc to this assignment.
Rubric
Criteria | Ratings | ||
---|---|---|---|
You uploaded your copy of the TPS Google doc
|
|
||
You made a reasonable attempt at the "thinking" portion and this was clearly marked on your document
|
|
||
You made a reasonable attempt at the "sharing" portion and this was clearly marked on your document
|
|
||
|