document.write('
Data hosted with ♥ by Pastebin.com - Download Raw - See Original
  1. /**
  2.  * @author Muhammad Bagus Istighfar
  3.  * @version 28-10-20
  4.  */
  5. public class Lot
  6. {
  7.   private final int number;  
  8.   private String description;  
  9.   private Bid highestBid;  
  10.  
  11.   public Lot (int number, String description)  
  12.   {  
  13.     this.number = number;  
  14.     this.description = description;  
  15.     this.highestBid = null;  
  16.   }  
  17.    
  18.   public boolean bidFor(Bid bid)  
  19.   {  
  20.     if (highestBid==null)  
  21.     {  
  22.       highestBid = bid;  
  23.       return true;  
  24.     }  
  25.     else if (bid.getValue() > highestBid.getValue())  
  26.     {  
  27.       highestBid = bid;  
  28.       return true;  
  29.     }  
  30.     else  
  31.     {  
  32.       return false;  
  33.     }  
  34.   }  
  35.  
  36.   public String toString()  
  37.   {  
  38.     String details = number + ": " + description;  
  39.     if (highestBid != null)  
  40.     {  
  41.       details += " Bid: " + highestBid.getValue();  
  42.     }  
  43.     else  
  44.     {  
  45.       details += " (No Bid)";  
  46.     }  
  47.     return details;  
  48.   }  
  49.  
  50.   public int getNumber()  
  51.   {  
  52.     return number;  
  53.   }  
  54.  
  55.   public String getDescription()  
  56.   {  
  57.     return description;  
  58.   }  
  59.  
  60.   public Bid getHighestBid()  
  61.   {  
  62.     return highestBid;  
  63.   }  
  64. }
');