Online Auction Program

Steven Zeil

Last modified: Jul 22, 2016
Contents:

1 Overview

Sellers at some of the better-known online auctioning sites complain about buyers who win an auction but then fail to make payment. Sellers sometimes give the excuse that they were bidding simultaneously on many items, and won more auctions than they had anticipated.

You are developing an online auction service where buyers will deposit funds with you before an auction, and where winning bids will be accepted only if sufficient funds remain in the bidder’s account.

Write a program to implement the rules of this auction, tracking the bids during a single day and determining the winners of each item for sale.

An auction is won by the highest bid that:

2 Input

There will be three input files, describing the items available for bid, the registered bidders, and the bids made during the auction, respectively. These three files will be named in the command line when the program is run.

2.1 Items

This file describes the items up for auction. It contains

You are guaranteed:

2.2 Bidders

This file describes the bidders who have registered for the auction. It contains

You are guaranteed:

2.3 Bids

This file describes the bids received in the day’s auction. It contains

You are guaranteed:

3 Output

Output will be written to standard out (cout) and will consist of a list of items (one per line) in order of their auction finish time. Each output line will have the form:

item-name won by bidder-name for winning bid amount

If there is not a winning bid for an item, for that item the output line will be:

item-name reserve not met

4 Example

4.1 Sample Input

Suppose that file items.dat contains:

2
5.00 05:06:27 Chinese Vase
25.00 15:30:11 Hummel Figurine

and that file bidders.dat contains:

2
jjones 37.37
ssmith 55.55

and that file bids.dat contains:

3
jjones 26.00 00:18:03 Hummel Figurine
jjones 60.00 04:03:01 Chinese Vase
ssmith 27.00 09:03:05 Chinese Vase

4.2 Sample Output

Then if the program is invoked like this

program-name items.dat bidders.dat bids.dat

the output should be

Chinese Vase reserve not met
Hummel Figurine won by jjones for 26.00