5 kyu
The Fruit Juice
1,002 of 1,427BattleRattle
Description:
In this kata we mix some tasty fruit juice. We can add some components with certain amounts. Sometimes we pour out a bit of our juice. Then we want to find out, which concentrations our fruit juice has.
Example:
- You take an empty jar for your juice
- Whenever the jar is empty, the concentrations are always 0
- Now you add 200 units of apple juice
- And then you add 200 units of banana juice
- Now the concentration of apple juice is 0.5 (50%)
- Then you pour out 200 units
- The concentration of apple juice is still 50%
- Then you add 200 units of apple juice again
- Now the concentration of apple juice is 0.75, while the concentration of banana juice is only 0.25 (300 units apple juice + 100 units banana juice)
Complete the functions in order to provide this functionality. The test code for the example above can be found in the test fixture.
Object-oriented Programming
Algorithms
Similar Kata:
Stats:
Created | Oct 20, 2013 |
Published | Oct 20, 2013 |
Warriors Trained | 3443 |
Total Skips | 414 |
Total Code Submissions | 14798 |
Total Times Completed | 1427 |
JavaScript Completions | 1002 |
Python Completions | 423 |
Total Stars | 95 |
% of votes with a positive feedback rating | 90% of 194 |
Total "Very Satisfied" Votes | 164 |
Total "Somewhat Satisfied" Votes | 21 |
Total "Not Satisfied" Votes | 9 |