diff --git a/IPA2/footwearProgram.java b/IPA2/footwearProgram.java index 01ad07e..348ea8f 100644 --- a/IPA2/footwearProgram.java +++ b/IPA2/footwearProgram.java @@ -61,18 +61,39 @@ public static int getCountByType(Footwear[] ft, String t) return 0; } } - - public static Footwear getSecondHighestPriceByBrand(Footwear[] ft, String name) - { - for(int i =0; i highest.getPrice()) + { + secondHighest = highest; + highest = ft[i]; + } + else if(secondHighest == null || ft[i].getPrice() > secondHighest.getPrice()) + { + secondHighest = ft[i]; + } } } - return null; + + return secondHighest; } + // public static Footwear getSecondHighestPriceByBrand(Footwear[] ft, String name) + // { + // for(int i =0; i