;;; ;;; auction.ss ;;; UVA CS200 Spring 2003 ;;; Problem Set 5 ;;; ;;; Version 1.0.1 - new for Spring 2003 (load "database.ss") ;;; Table of people who can bid on items (define bidders (make-new-table (list 'name 'email))) ;;; Table of the items currently up for auction (define items (make-new-table (list 'item-name 'description))) ;;; Table of all bids on (define bids (make-new-table (list 'bidder-name 'item-name 'amount))) ;;; setup-tables puts some entries in the tables for testing (define (setup-tables) (add-bidder "Tim Koogle" "tk@yahoo.com") (add-bidder "Katie Couric" "katie@nbc.com") (add-bidder "Dave Matthews" "dave@dmb.com") (post-item "SEAS" "School of Engine and Apple Science") (post-item "CLAS" "School of (Liberal) Arts and Sciences") (post-item "AFC" "Aquatic and Fritters Center") (post-item "MEC" "Multimedia Enhanced Classroom Building") (insert-bid "Tim Koogle" "SEAS" 10000000) (insert-bid "Dave Matthews" "CLAS" 2000000) (insert-bid "Katie Couric" "SEAS" 15000000) (insert-bid "Tim Koogle" "SEAS" 12000000)) (define (make-string-selector match) (lambda (fval) (string=? fval match))) (define (get-bids item) (table-entries (table-select bids 'item-name (make-string-selector item)))) (define (cancel-bids bidder) (table-delete! bids 'bidder-name (make-string-selector bidder))) ;;; Initially, the University has a $12M deficit. (define university-funds -12000000)