executing:
./cs450grade_undergrad.sh 0 0 0 0 0 0 0 0 0
#!/bin/bash
echo "$1,$2,$3,$4,$5,$6,$7,$8,$9" |\
gawk -v RS=, 'BEGIN{split("hw1 hw2 hw3 mid hw4 hw5 hw6 fin proj",name); split("15 15 15 40 15 15 15 70 50",maxpoints)} {line++; print name[NR],$0/maxpoints[NR],maxpoints[NR]}' | sort -k 2 -nr | awk 'max < 100 {rest=($3+max<100)?$3:100-max; max+=rest; score+=rest*$2; print "scored "$2*$3"/"$3" on "$1" prorated at "rest"/"$3"="100*rest/ $3"%, aggregate score",score"/"max}'
scored 0/50 on proj prorated at 50/50=100%, aggregate score 0/50
scored 0/40 on mid prorated at 40/40=100%, aggregate score 0/90
scored 0/15 on hw6 prorated at 10/15=66.6667%, aggregate score 0/100