Drink up
We’ve been watching how much three people drink for three days. For Science! We’ve got some data, and now we need to make some calculations.
Here’s the data: data-1.
The Original
Use TDD and write code to answer the following questions.
How much?
Write one function that answers these three questions.
- How many coffees were drunk on Monday?
- How many teas were drunk on Tuesday?
- How many waters were drunk on Wednesday?
Who?
Write new function(s) that answer these three questions.
- Who drank the least coffee on Monday?
- Who drank the most tea on Tuesday?
- Who drank the least water on Wednesday?
Thursday? Thursday!
The Science People were impressed with our calculations and have sent us some more data. They sent it via carrier pigeon, then fax, which was typed out and emailed to us. The data for Thursday was: data-2.
Write some new tests, but no new functions, to check that your code answers the following questions correctly.
- How many coffees were drunk on Thursday?
- How many teas were drunk on Thursday?
- How many waters were drunk on Thursday?
- Who drank the least coffee on Thursday?
- Who drank the most tea on Thursday?
- Who drank the least water on Thursday?
The Sequel: Per Person?
Now The Science People want some more personal information. Write some new code that answers the following questions.
- How many coffees did Lesego drink on Monday?
- How many teas did Brenda drink on Tuesday?
- How many waters did Mdu drink on Wednesday?
The Sequel Sequel: Friday
The Science People have sent one last data burst: Friday! Here it is: data-3.
- Who drank the most coffee during all five days?
- Who drank the least tea during all five days?
- Who drank the most water during all five days?
- How many coffees did Mdu drink during all five days?
- How many teas did Brenda drink during all five days?
- How many waters did Lesego drink during all five days?