Starting from:
$35

$29

Tracking Online Auctions Solution

Introduction




Your aunt is impressed with your programs and would like you to develop an application that tracks the status of an online auction. Bidding begins at $1 and proceeds in increments of at least $1. If a bid arrives that is less than the current bid, it is discarded. If a bid arrives that is more than the current bid, but less than the maximum bid by the current high bidder, then the current bid for the current high bidder is increased to match it and the new bid is discarded. If a bid arrives that is more than the maximum bid for the current high bidder, then the new bidder becomes the current high bidder, at a bid of one more than the previous high bidder’s maximum. When the auction is over (the end of the input is reached), a history of the actual bids (the ones not discarded), from high bid to low bid, should be displayed. For example:




New Bid
Result
High Bidder
High Bid
Maximum Bid
7 John
New high bidder
John
1
7
5 Hank
High bid increased
John
5
7
10 Jill
New high bidder
Jill
8
10
8 Thad
No change
Jill
8
10
15 Joey
New high bidder
Joey
11
15



The bid history for this auction would be


Joey
11
Jill
8
John
5
John
1



Problem Statement




Design and implement an application TrackingOnlineAuction.java to track the status of an online auction for your aunt.




Design Remarks




Use the ABStack.java class to support the application.




Program Input




The program gets its input from a data file (bids.txt) with data organized as follows:

Each line in the input file represents a new bid.




Each line contains an integer (that represents a maximum bid) followed by the name of the bidder.




Here are the first few lines in a sample input file that represent the bid example given above:

John
Hank
Jill
Thad
Joey






Program Output




As input proceeds, the current status of the auction must be displayed. The final output must include the bid history as described above.




Here is a sample output for the sample input given above:




New Bid Result High Bidder High Bid Maximum Bid

-------------------------------------------------------------------------------




7
John
New high bidder
John
1
7
5
Hank
High bid increased
John
5
7
10 Jill
New high bidder
Jill
8
10
8
Thad
No change
Jill
8
10
15 Joey
New high bidder
Joey
11
15
The bid history for this auction is:






Joey
11






Jill
8






John
5






John
1









Submission Instructions




When you are satisfied with your implementation, and after testing it thoroughly, submit the TrackingOnlineAuction.java file via Blackboard Learn.

More products