package lingtao.net.util; import java.util.List; import lingtao.net.bean.Product; public class FerruleUtil {//会员卡卡套 int countList[] = {100, 200, 300, 500, 1000}; double priceList[] = new double[5]; public List getPrice(double length, int count, List list) { if(length == 19.5) { priceList = new double[]{800, 1500, 1950, 2500, 4000}; }else if(length == 15.5) { priceList = new double[]{600, 1100, 1500, 2000, 3000}; }else{ priceList = new double[]{600, 1000, 1180, 1680, 2800}; } for(int i = 0;i< countList.length;i++) { if(countList[i] < count || list.size() > 2) { continue; } Product pro = new Product(); pro.setPrice(priceList[i]); pro.setCount(countList[i]); list.add(pro); } return list; } }