PBKK - EAS Contribution Based Evaluation

Image
Pendahuluan Puji syukur kehadirat Tuhan YME yang selalu memberi kami dorongan untuk bekerja ikhlas dan selalu bersemangat dalam belajar, belajar dan belajar. Karya ini kami persembahkan di masa pandemi. Semoga dapat memudahkan khalayak ramai dalam memberikan bantuan dan info seputar COVID-19. Sekian dan terimakasih Kelompok SIP Darfi Sultoni 05111740000063 Bima Satria Ramadhan 05111740000081 Yudhistiro Adi Nugroho 05111740000165 Kevin Ashil Faadilah 05111740000178 Web CodeIgniter Site :  http://fp-pbkk.notlusss.xyz/ Source :  https://github.com/maybefunny/fp-pbkk Link Youtube :  https://youtu.be/6yzQWtwJetM Deskripsi Aplikasi Web ini bernama SIP atau Sistem Informasi Pandemi dimana web ini berfungsi untuk memberi tahu kepada masyarakat umum keperluan apa saja yang dibutuhkan pada masa pandemi seperti ini dan web ini juga menyediakan fitur untuk donasi. Pada tampilan ini memiliki beberapa fitur, di antaranya :  Home / Landing Page Tentang Donas

Tugas PBO-A Membuat Sistem Lelang (Auction System)

Class yang digunakan ada 4, yaitu :
1. Lot
2. Person
3. Auction
4. Bid

Bisa dilihat dari tampilan berikut ini


Cara Menjalankannya adalah dengan cara menggunakan fungsi auction yaitu void enterlot(String description) untuk memasukkan barang yang di lelang :
Setelah itu tambahkan fungsi person untuk orang yang akan ikut lelang
Lalu Masukkan bid yang di inginkan dengan cara menginputkannya di fungsi auction yaitu void bidFor(int lotNumber, Person bidder, long value) untuk memaasukkan jumlah penawaran pada barang yang dilelang
Kita bisa mengecek apakah penawaran tersebut sudah berhasil dilakukan atau belum dengan cara melihatnya di fungsi auction yaitu void showLots()
jika penawaran selesai gunakan fungsi void close() di auction maka akan terlihat siapa yang melakukan penawaran tertinggi
Selesai,

Source Code
1. Lot

 /**   
  * A classto model an item an item (or set of items) in an auction: a lot.   
  *   
  * @author (Yudhistiro Adi Nugroho)   
  * @version (07.10.2018)   
  */   
  public class Lot   
  {   
   // A unique identifying number.   
   private final int number;   
   //A description of the lot.   
   private String description;   
   // The current highest bid for this lot.   
   private Bid highestBid;   
   /**   
   * Construct a Lot, setting its number and description.   
   * @param number The lot number.   
   * @param description A description of this lot.   
   */   
   public Lot(int number, String description)   
   {   
    this.number = number;   
    this.description = description;   
   }   
   /**   
   * Attempt to bid for this lot. A successful bid   
   * must have a value higher than any existing bid.   
   * @param bid A new bid.   
   * @return true if successful, false otherwise.   
   */   
   public boolean bidFor(Bid bid)   
   {   
    if((highestBid == null)||(bid.getValue() > highestBid.getValue()))   
    {   
     // This bid is the best so far   
     highestBid = bid;   
     return true;   
    }   
    else{   
     return false;   
    }   
   }   
   /**   
   * @return A string representation of this lot's details.   
   */   
   public String toString()   
   {   
    String details = number + ": " + description;   
    if(highestBid!=null) {   
     details+= " Bid: " +highestBid.getValue();   
    }   
    else {   
     details += " (No bid)";   
    }   
    return details;   
   }   
   /**   
   * @return The lot's number.   
   */   
   public int getNumber()   
   {   
    return number;   
   }   
   /**   
   * @return The lot's description.   
   */   
   public String getDescription()   
   {   
    return description;   
   }   
   /**   
   * @return The highest bid for this lot.   
   * This could be null if there is no current bid.   
   */   
   public Bid getHighestBid()   
   {   
    return highestBid;   
   }   
  }   

2. Person
 /**   
  * A classto model an item an item (or set of items) in an auction: a lot.   
  *   
  * @author (Yudhistiro Adi Nugroho)   
  * @version (07.10.2018)   
  */  
 public class Person   
  {   
   // The name of this person.   
   private final String name;   
   /**   
   * Create a new person with the given name.   
   * @param name The person's name.   
   */   
   public Person(String name)   
   {   
    this.name = name;   
   }   
   /**   
   * @return The Person's name*   
   */   
   public String getName()   
   {   
    return name;   
   }   
  }   

3. Auction
 /**   
  * A classto model an item an item (or set of items) in an auction: a lot.   
  *   
  * @author (Yudhistiro Adi Nugroho)   
  * @version (07.10.2018)   
  */  
 import java.util.ArrayList;   
  import java.util.Iterator;   
  public class Auction   
  {   
   // The List of Lots in this auction.   
   private ArrayList<Lot> lots;   
   // The number that will be given to the next lot entered   
   // into this auction   
   private int nextLotNumber;   
   /**   
   * Create a new auction   
   */   
   public Auction()   
   {   
    lots = new ArrayList<Lot>();   
    nextLotNumber = 1;   
   }   
   /**   
   * Enter a new lot into the auction.   
   * @param description A description of the lot.   
   */   
   public void enterLot(String description)   
   {   
    lots.add(new Lot(nextLotNumber, description));   
    nextLotNumber++;   
   }   
   /***    
   * Show the full list of lots in this auction.   
   */   
   public void showLots()   
   {   
    for(Lot lot : lots){   
     System.out.println(lot.toString());   
    }   
   }   
   /**   
   * Bid for a lot.   
   * A message indicating whether the bid is succesful or not is printed.   
   * @param number The lot number being bid for.   
   * @param bidder The person bidding for the lot.   
   * param value The value of the bid.   
   */   
   public void bidFor(int lotNumber, Person bidder, long value)   
   {   
    Lot selectedLot = getLot(lotNumber);   
    if(selectedLot!=null){   
     boolean successful = selectedLot.bidFor(new Bid(bidder,value));   
     if (successful) {   
      System.out.println("The bid for lot number " + lotNumber +    
      " was successful.");   
     }   
     else {   
      //Report which bid is higher.   
      Bid highestBid = selectedLot.getHighestBid();   
      System.out.println("Lot number: " + lotNumber +    
      " already has a bid of: " + highestBid.getValue());   
     }   
    }   
   }   
   /**   
   * Return a list of the unsold lots.   
   */   
   public void close()   
   {   
    System.out.println("The auction is closed.");   
    for(Lot lot : lots) {   
     System.out.println(lot.getNumber() + ": " +lot.getDescription());   
     Bid bid = lot.getHighestBid();   
     if (bid==null){   
      System.out.println("(No Bids for this lot.)");   
     }   
     else {   
      System.out.println( "sold to " +    
      bid.getBidder().getName() + " for "    
      + bid.getValue());   
    }   
   }   
  }   
   /**    
   * Return the lot with the given number.    
   * Return null if a lot with this number does not exist.   
   * @param lotNumber The number of the lot to return.   
   */   
   public Lot getLot(int lotNumber)   
   {   
    if((lotNumber >= 1) && (lotNumber < nextLotNumber)) {   
     // The number seems to be reasonable.   
     Lot selectedLot = lots.get(lotNumber - 1);   
     // Include a confidence check to be sure we have the right lot.   
     if(selectedLot.getNumber() != lotNumber) {   
      System.out.println("Internal error: lot number " +   
      selectedLot.getNumber() + " was returned instead of " +    
      lotNumber);   
      // Don't return invalid lot.   
      selectedLot = null;   
      }   
      return selectedLot;   
     }   
    else {   
     System.out.println("lot number: " + lotNumber + " does not exist.");   
     return null;   
     }   
    }   
   }    

4. Bid
 /**   
  * A classto model an item an item (or set of items) in an auction: a lot.   
  *   
  * @author (Yudhistiro Adi Nugroho)   
  * @version (07.10.2018)   
  */  
 public class Bid   
  {   
   // The person making the bid   
   private final Person bidder;   
   // The value of the bid. This could be a large number so the long type has been used   
   private final long value;   
   /**   
   * Create a bid   
   * @param bidder Who is bidding for the lot.   
   * @param value The value of the bid.   
   */   
   public Bid(Person bidder, long value)   
   {   
    this.bidder = bidder;   
    this.value = value;   
   }   
   /**   
   *@return The bidder.   
   */   
   public Person getBidder()   
   {   
    return bidder;   
   }   
   /**   
   * @return The value of the bid.   
   */   
   public long getValue()   
   {   
    return value;   
   }   
  }   

Comments

Popular posts from this blog

Analisa Sistem Informasi Tokopedia

Bionic Arm

Toko Samsung Terbesar di Asia Tenggara Ada di Bali