CS 2204: Final Exam
What to turn in: Submit your work (a single, well commented script )
as specified on your class' web page.
The first comment line at the top of
the script should be your full name
and student ID.
Assignment.
Many people, especially of old age, are sensitive to
weather changes: for example, the likelihood of cardiovascular
episodes has been shown to increase a day before a drastic
change in weather conditions. In this assignment you will prepare
a (bash or perl) script that will inform your grandparents of
upcoming worrisome changes in their local weather. We will call
the change in the local weather "worrisome" if any of the following
is true: either the high temperature is about to change by more than
THMAX degrees or/and the low (night) temerature
is going to change by more than TLMAX degrees F.
The script
you will write should do the following. It takes
three integer arguments, valid_zip_code THMAX and
TLMAX and produces a PDF file with the "medical forecast"
for the next week. The forecast will be a two row table, with
days/dates in the top row and an indicator for good and bad
days right below.
For example, suppose today is Monday. You execute your script
as onufriev_FINAL.sh 92122 5 5 . Suppose the
weather report for San Diego
predicts the high temperature of 66 F for the whole week,
and low temperature of 55 F for today, 57
for Tue and 45 for Wed. Then your script
should pick Tue as a ``worrisome"
day. It should be marked by a red plus sign in the calendar.
Other days (such as Monday in this example)
can be marked by a green "OK" (or whatever).
There are many possible solutions. For example, you can use PERL.
You can execute unix commands from within a PERL script just like you do
in bash (the syntax details are bit different. See any PERL manual). You can also use bash directly, and
call egrep and/or gawk from it. You may want your
script to produce an auxilary file along the way. You don't have to find the most elegant solution, just a unix-based solution that works.
Make sure your script DOES WORK before you submit it. Test
it thoroughly. You will likely get zero credit if it does not work as
described above, that is does not produce the data requested.
(well, the output table does not have to look
exactly as described, you can tweak it a bit according to your taste ).
The script should have comment lines inside which
tell what each major part of the code does. Follow the examples described
in class and solutions of HWs and labs. No comments -- points off.
Somewhere around the top comment lines you should (briefly)
describe how to set things up so that your script is executed and
an email with the PDF file (forecast) is sent to GrannySmith@yahoo.com every Monday, at 6 am. You don't have to actually set this up on your machine,
just describe how you would do that.
Hint: there is more than one website that has the info you need.
Also, each website
offers you a set of different formats for the weather info.
Some of these formats are
super-easy to parse. So, think befroe you plunge into coding! But don't pick
up some obscure website in Ivoy Coast: you want to be reasonable sure
it will work on the day we test your code. That is why you want to test it
more than once before you submit. There is a very remote possibility that
a code that works on your machine won't work on the unix lab machine.
Since this is a common machine for the entire class, we require that your
code works there. Excuses such "it worked on my laptop" won't be accepted --
obviously, we won't have an access to your laptop.