DWITE Online Computer Programming Contest

Candybar Graphs

October 2012
Problem 2

Besides candy, you have also collected data on how many houses gave out candy on each street. Having this in a handy chart would significantly optimize your candy-gathering next year!

The input file DATA2.txt will contain 5 lines, each being a pair of non-negative integers separated by a single space. The first is the number of houses that gave out candy on that street. The second is the number of houses that did not. There will be at least one house on each street.

The output file OUT2.txt will contain 5 ASCII percent bar graphs showing the proportion of candy-giving houses to candy-free houses. Each line will be 10 characters long, and percents will be rounded down to the nearest 10%. For example, 19% and 10% both round down to 10%. Use asterisks (*) for the candy part, followed by periods (.) for the candy-free houses.

Sample Input:
0 1
1 9
19 81
99 1
1 0
Sample Output:
..........
*.........
*.........
*********.
**********