A video-rental company called Web-Flicks provides two plans for customers: DVDs-by-mail and on-demand streaming. In this assignment, you'll create data definitions for video rental plans, and write programs over those data definitions.
A rental plan can be either of the following:
monthly-cost
that consumes a rental plan
and produces a number that represents the monthly cost of the plan. If the plan is for DVDs by mail, the basic monthly cost is based on the number of DVDs shipped at once: $7.99 for 1, $8.99 for 2, $9.99 for 3, and $10.99 for 4. If the DVDs are
high definition, $0.50 per DVD is added to the cost. If the plan allows the
customer to keep the DVDs for an unlimited amount of time,
an additional $3.00 per month is charged.
Streaming plans cost $2.99 for SD, and $4.99 for HD. If the plan is for unlimited streaming, an additional $5.00 is added to the monthly cost.
make-high-def
that consumes a rental plan
and
produces a rental plan. The plan that is produced is the same as the original,
except that the produced plan is HD. If the original plan was already HD, the
produced plan is the same as the original.
;; a ListOfString is one of ;; empty ;; (cons String ListOfString) ;; interp: ListOfString represents a list of strings
contains-all-numbers?
that consumes a
ListOfString and produces true if at least one string in the list consists
entirely of
numeric characters.
Otherwise, the function produces false. (Hint: check the DrRacket
help desk for various string functions). Here are two sample test cases (you may need additional test cases):
(check-expect (contains-all-numbers? (cons "CS1101" (cons "A1" (cons "32" empty)))) true) (check-expect (contains-all-numbers? (cons "CS1101" (cons "A-one" empty)))) false)
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.
lengths-of-strings
that consumes a ListOfString
and produces a ListOfNatural. The function produces a list of the lengths of
each of the strings in the given ListOfString.
Using web-based turnin, turn in a single file containing all code and documentation for this assignment. Name your file according to the naming conventions for files. Make sure both partners' names and login names appear at the top of the file in a comment.