For weeks, firefighters have been battling wildfires in California. Floods have plagued areas in Louisiana, Missouri, and Texas. In this assignment, you'll create data definitions for various kinds of weather-related phenomena, and write programs over those data definitions.
A storm can be any one of the following (use the names in bold letters to name your structs):
Ask a lab assistant to check over your work at this point.
Ask a lab assistant to check over your templates.
If you're working with a homework partner... You and your partner should review the data definitions and templates you each came up with in Lab 2. Make changes, if necessary, and complete any of the exercises you didn't get to during the lab. Create your Homework 2 file according to the naming conventions for homework files, and copy/paste your data definitions and templates into your homework file.
If you're working by yourself... copy your Lab 2 work into your Homework 2 file (name your file yourLastName-hw2
), and continue working on Homework 2.
Everyone... Make sure your function names are exactly the same as the names given in the problems. Otherwise, our auto-tester will fail, and you will lose points.
high-impact?
that consumes a storm
and produces a boolean. The function returns true if the storm is a category
4 or 5 hurricane, a thunderstorm with more than 3 inches of rainfall and
winds exceeding 60mph, or a fire covering at least 50 square miles.
change-heading
that consumes a storm and
a heading and
produces a storm. The storm is returned
unchanged if the given storm is a fire. Otherwise, the storm that's produced is a storm
the same as the original, except that the heading has been changed to the
given heading.
;; a ListOfString is one of ;; empty ;; (cons String ListOfString) ;; interp: ListOfString represents a list of strings
character-count
that consumes a ListOfString
and
counts the total number of
characters in all strings in the list.
numeric-strings
that consumes a ListOfString and produces a ListOfString. The list that's produced contains only those strings from the original list that consist entirely of numeric characters. (Hint: check the DrRacket help desk for various built-in string functions that will help you solve this problem).
count-X
that consumes a ListOfString and counts the total number of X's (upper and lower case) that occur in all strings in the list. Hint: helper functions are your friend. Check the help desk again for built-in-functions that might be useful.
Submit your .rkt
file to InstructAssist. The name of the project is Homework 2
.
Make sure both partners' names and login names appear at the top of the file in a comment.