Assume that for each river, measurements of the river's pH and DO (dissolved oxygen) levels are available. Such measurements are taken at the confluence of the rivers (the point at which the tributaries converge). pH levels can range from 0 (most acidic) to 14 (most alkaline). The normal range for bodies of water are 6.5 - 8.5. DO is measured in milligrams per liter (mg/L). DO levels are dependent on many factors, including water temperature, salinity, atmospheric pressure, aeration, and bacterial levels. Dissolved oxygen levels can range from less than 1 mg/L to more than 20 mg/L depending on how all of these factors interact.
Copy over the work you did for Lab 5 into your Homework 5 file, and continue with the remaining problems.
list-acidic-rivers
that consumes a river system and
produces a list of string. The function returns a list of the names of rivers in the system that have a pH level lower than 6.5.
lower-all-ph
that consumes a river system and
produces a river system. The river system that is produced is the same as the original,
except that the pH of all the rivers in the system has been lowered
by 0.1.
cold-water-fish-warning
that consumes a river system and produces a string. If all rivers in the system have DO levels at 5mg/L or above, the string produced is "OK". If any of the rivers in the system have a DO level below 3 mg/L, the function produces the string "Deadly". Otherwise, the string produced is "Marginal". You'll need to use helpers here. Think about where you'll want to use the templates.
find-subsystem
that consumes the name of a river and a river system and produces either a river system or false. The function returns the portion of the original river system that has the named river as its root. If there is no river in the system with the given name, the function returns false.
find-subsystem
to write a function count-acidic-tributaries-of
that consumes a river system and the name of a river. The function produces a count of the number of tributaries of the named river which have a pH < 6.5. You may assume the named river exists in the river system. You should count the acidic tributaries only, (don't include the named river itself in your count).
Submit your .rkt
file to InstructAssist.
Name your file according to the
naming conventions for files. Make sure both partners' names and wpi login names appear in a comment at the top of the file.