1 package samples.bidbuy; 2 3 6 public class BidService { 7 8 static int nextReceiptNumber = 9000; 9 10 16 public double RequestForQuote(String productName, int quantity) { 17 if (quantity < 100) { 18 return 1.0 * quantity; 19 } if (quantity < 1000) { 20 return 0.8 * quantity; 21 } else { 22 return 0.7 * quantity; 23 } 24 25 } 26 27 37 public String SimpleBuy(String productName, String address, int quantity) { 38 return Integer.toString(nextReceiptNumber++) + "\n" + 39 quantity + " " + productName; 40 } 41 42 46 public String Buy(PurchaseOrder PO) { 47 String receipt = Integer.toString(nextReceiptNumber++); 48 49 for (int i=0; i<PO.getItems().length; i++) { 50 LineItem item = PO.getItems()[i]; 51 receipt += "\n " + item.getQuantity() + " " + item.getName(); 52 } 53 54 return receipt; 55 } 56 57 60 public void Ping() { 61 } 62 63 } 64 | Popular Tags |