Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- BEGIN{ FS=":"
- print " ***FIRST QUARTERLY REPORTS*** "
- print " ***CAMPAIGN 2000 CONTRIBUTIONS*** "
- print "-------------------------------------------------------------------------------------"
- print "Name Phone Jan | Feb | Mar | Total Donated"
- print "-------------------------------------------------------------------------------------"
- min = 9999;
- max = 0;
- }
- {
- for (i = 3; i < 6; i++)
- {
- if ($i < min)
- min = $i
- if ($i > max)
- max = $i
- }
- totalCont = $3+$4+$5;
- total = total+totalCont;
- average = (total / 12);
- highestTotal;
- highestNameLong;
- highestNameShort;
- { if (totalCont > 500)
- printf(" %-s--%s \n",
- $1, $2 ) | "sort -k 2" }
- {split($1,highName," ")}
- if ($3+$4+$5 > highestTotal)
- { highestTotal = $3+$4+$5
- highestNameLong = $1
- highestNameShort = highName[1]
- }
- printf ("%-20s %-17s %-.2f\t%-.2f \t%-.2f \t\t%-.2f \n", $1, $2, $3, $4, $5, totalCont)
- }
- END{print "--------------------------------------------------------------------------------------"
- print " SUMMARY "
- print "--------------------------------------------------------------------------------------"
- printf ("The campaign received a total of $%.2f for this quarter.\n", total)
- printf ("The average donation for the 12 contributors was $%.2f.\n", average)
- printf ("The highest contribution was $%.2f.\n", max)
- printf ("The lowest contribution was $%.2f.\n", min)
- printf ("The highest total contribution was $%.2f made by %s\n", highestTotal, highestNameLong)
- print " ***THANKS "highestNameShort"***"
- print "The following people donated over $500 to the campaign."
- print "They are eligible for the quarterly drawing!!"
- print "Listed are their names (sorted by last names) and phone numbers:"
- close("sort -k 2");
- printf (" Thanks to all of you for your continued support!!\n")
Add Comment
Please, Sign In to add comment