Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public Product CostliestPro(Product[] i){
- float max=0;
- for(Product b:i)
- if(b.getPrice()>max)
- max=b.getPrice();
- for(Product:i)
- if(b.getPrice()==max)
- return b;
- }
- public Product CostliestPro(Product[] i){
- float max=0;
- for(Product b:i){
- if(b.getPrice()>max){
- max=b.getPrice();
- }
- }
- for(Product b:i){
- if(b.getPrice()==max){
- return b;
- }
- }
- return null;
- }
- public Product CostliestPro(Product[] i){
- float max=0;
- Product maxProduct = null;
- for(Product b:i){
- if(b.getPrice()>max){
- max=b.getPrice();
- maxProduct = b;
- }
- }
- return maxProduct;
- }
Add Comment
Please, Sign In to add comment