20-CS-122-001 Computer Science II Spring 2012
Concentrations

Virtual functions, classes, inheritance, lists, queues, stacks, applications

Setup:
    Consider two jars of equal size, one with exactly 1 liter of blue ink and the other with exactly 1 liter of clear water. Consider a spoon of capacity p liters, where p is a number between 0 and 1. Consider the following experiment: dip the spoon into one jar and pull out p liters of fluid. Dump all of that fluid into the other jar. Stir the other jar. Then dip the spoon into that jar, pull out p liters of fluid, and dump that fluid into the first jar. Stir and repeat indefinitely.

Problem:
    Write a program that takes spoon capacity (p) as input and outputs the concentration of blue ink in each of the jars after 100 dips. For example, if the spoon size is 0, then one jar will be 100% blue ink and the other 0%; if the spoon size is 1, both jars will have 50% concentration of blue ink.

Algorithm:
    Too simple to state