CS 1101 - Aterm 08

Homework 3 - Mixed Data

Due: Friday, September 12 at 11:59pm

Read the expectations on homework.

Assignment Goals


The Assignment

The college bookstore carries items that are sold under one of three categories: books, clothing, and sundries. You will define data and write programs that manage the inventory of bookstore items.

Writing Programs for Mixed Data

  1. Develop a data definition for bookstore items that covers all types of items described above (you will need to make multiple data definitions). Provide examples of bookstore items.

  2. Provide the template for each data definition you made in Problem 1.

  3. Write a function cost-of-item that consumes a bookstore item and returns the cost of the item. If the item is a book, and the book is used, then the cost is reduced by 20%.

  4. Write a function sale-item? that consumes a bookstore item and returns true if that item is included in the bookstore's annual sale. Sale items are any books that are not hardcover, and any clothing item in size XS or S.

  5. Write a function update-inventory that consumes a bookstore item and the quantity of those items purchased, and produces a bookstore item. The item produced is the same as the original, except that the number remaining in the inventory is reduced by the number purchased.

What to Turn In

Using web-based turnin, turn in a single file hw3.scm containing all code and documentation for this assignment. Make sure both partners' names and login names appear at the top of the file in a comment.