In this assignment, you will develop data definitions and functions for restaurants, and for reservations made at restaurants.
Remember that each function should have a signature and a purpose, and should
be tested using check-expect
.
A restaurant is specified as follows: the name of the restaurant, the type of food served (Italian, seafood, steakhouse, etc.), the number of tables in the restaurant, the total capacity (i.e. the number of seats), and whether or not the restaurant provides vegetarian offerings. Develop a complete data definition for a restaurant. Provide three examples of restaurants created using your data definition.
In a comment in the Definitions window, write the function names and signatures for all the functions (constructor, selector(s), predicate) that Racket creates from your define-struct in the previous question.
restaurant-type
that consumes a restaurant and produces a
string. If the restaurant has at least 30 tables and the capacity to hold at least 250 customers, the function produces "event venue". Assuming that's not the case, then if the restaurant provides vegetarian offerings, the function produces "vegetarian-friendly". Otherwise, the function produces the type of food served at the restaurant.
Develop a data definition for a restaurant reservation. A reservation contains the restaurant the reservation is for, the name of the person making the reservation, his/her telephone number, the date that the reservation is for, and the number of people in the party. Carefully consider how you want to represent the date of the reservation (see Problem 6 below). Provide three examples of restaurant reservations using your data definition.
add-to-party
that consumes a restaurant
reservation and a number and creates a restaurant reservation.
The reservation that is produced is the same as the original, except that
the number of people in the party has been increased by the given number.
precedes?
that consumes
two dates, and returns true if the first date precedes the second date. Otherwise
the function returns false.
reservation-OK?
that consumes a room
reservation and and a date (ostensibly today's date) and produces a boolean.
A reservation is not OK if it is for a date that precedes the given date, or if it is for
a party with more people than the restaurant can hold. Otherwise, the reservation
is OK.
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 in CS 1101.Both partners' names and wpi usernames must appear in a comment at the top of the file.