Skip to content

corrected logic to find second highest priced footwear#23

Open
BMN5 wants to merge 1 commit into
Arijit-SE:mainfrom
BMN5:patch-1
Open

corrected logic to find second highest priced footwear#23
BMN5 wants to merge 1 commit into
Arijit-SE:mainfrom
BMN5:patch-1

Conversation

@BMN5

@BMN5 BMN5 commented Jul 10, 2026

Copy link
Copy Markdown

getSecondHighestPriceByBrand() method is not implemented correctly.

Currently, it simply returns the first footwear whose brand matches:

for(int i =0; i<ft.length; i++)
{
if(ft[i].getName().equalsIgnoreCase(name))
{
return ft[i];
}
}

But the question asks you to:

Consider only footwears with the given brand.
Find the footwear with the second highest price.
Return that footwear object.

getSecondHighestPriceByBrand() method is not implemented correctly.

Currently, it simply returns the first footwear whose brand matches:
for(int i =0; i<ft.length; i++)
{
    if(ft[i].getName().equalsIgnoreCase(name))
    {
        return ft[i];
    }
}

But the question asks you to:

Consider only footwears with the given brand.
Find the footwear with the second highest price.
Return that footwear object.

Signed-off-by: Manjunadh bhavaraju <161492906+BMN5@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant