#!/usr/athena/bin/perl

open(BOYS, "/afs/athena/user/m/k/mkgray/.*/lists/boys");
open(GIRLS, "/afs/athena/user/m/k/mkgray/.*/lists/girls");

while(<BOYS>)
{
	($name, $gen, $responses, $phone) = split(/:/, $_);
	@choices = split(/[0-9]/, $responses);
	@weights = split(/[a-z]/, $responses);
	foreach $x (1..30) {
	$boywtot[$x] += $weights[$x];
	$boytot += $weights[$x];
	}	
	$nb++;
}

while(<GIRLS>)
{
	($name, $gen, $responses, $phone) = split(/:/, $_);
	@choices = split(/[0-9]/, $responses);
	@weights = split(/[a-z]/, $responses);
	foreach $x (1..30) {
	$girlwtot[$x] += int($weights[$x]);
	$girltot += $weights[$x];
	
	$ng++;
}

}
print("Boytot:  $boytot\n");
print("Girltot: $girltot\n");
foreach $n (1..25) {
	$b = int(1000*$boywtot[$n]/$boytot);
	$g = int(1000*$girlwtot[$n]/$girltot);
	$r = int(100*$b/$g);
	$o = $boywtot[$n]/$nb + $girlwtot[$n]/$ng;
	$o =int($o);
	print("Question #$n:\t  $r:$o  \t$b, $g ($boywtot[$n]/$girlwtot[$n])\n");
}






