Answered step by step
Verified Expert Solution
Question
1 Approved Answer
****PLEASE USE THE SCHEME/RACKET LANGUAGE. USE ONLY THE SCHEME/RACKET LANGUAGE***** 4. Design and implement a SCHEME object that represents a library. Your library should be
****PLEASE USE THE SCHEME/RACKET LANGUAGE. USE ONLY THE SCHEME/RACKET LANGUAGE*****
4. Design and implement a SCHEME object that represents a library. Your library should be able to store book objects. You should be able to create a library by evaluating the make-library function which takes no param- eters. Therefore, the library starts with no books. Your library object should expose the following functions add - which takes one parameter, a book object, and stores it inside the library . find-author - which takes one string as a parameter, the author's name, and returns a list of author/title pairs (as a pair of strings) for all book objects in the library which were written by that author . find-title - which takes one string as a parameter, the title of the book(s) you wish to find, and returns a list of author/title pairs for all book objects in the library which share that title You should be able to test your code with the following test data: (define mylib (make-1ibrary)) ((mylib 'add) (make-book "Harry Potter and the Philosopher 's Stone" "Rowling")) ((mylib 'add) (make-book "Harry Potter and the Chamber of Secrets""Rowling")) ((mylib 'add) (make-book "Harry Potter and the Prisoner of Azkaban" "Rowling")) ((mylib 'add) (make-book "Harry Potter and the Goblet of Fire "Rowling")) ((mylib 'add) (make-book "Harry Potter and the Order of the Phoenix""Rowling")) ((mylib 'add) (make-book "Harry Potter and the Half-Blood Prince" "Rowling")) ((mylib 'add) (make-book "Harry Potter and the Deathly Hallows" "Rowling" )) ((mylib 'add) (make-book "The Hunger Games" "Suzanne Collins")) ((mylib 'add) (make-book "Catching Fire" "Suzanne Collins")) ((mylib 'add) (make-book "Mockingjay" "Suzanne Collins")) ((mylib 'add) (make-book "The Magician" "Michael Scott")) ((mylib 'add) (make-book "The Magician" "W. Somerset Maugham")) ((mylib 'find-title) "The Magician") ((mylib 'find-author) "Suzanne Collins") ((mylib 'find-author) "Rowling")Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started