How to find biggest two int. numbers from four

Hello... this is my first thread I'm posting, so sorry if I may make some mistakes.

So, if you are a football/soccer fan, you know that in every FIFA World Cup you have 4 nations. From those 4, 2 will qualify to the Knockout stages.

Let's say, after all the group fixtures are played, the standings are as follows :

1. England - 6 points

2. Spain - 4 points

3. Brasil - 3 points

4. Germany - 1 point

I want to know how I can select ONLY England and Spain for the Knockout stage of the FIFA World Cup (The class I am working on).

Thank you very much for your help.

- Keimic53

Re: How to find biggest two int. numbers from four

Re: How to find biggest two int. numbers from four

Hello Norm, thank you for your time.

Let's say each group's variables are:

int t1, t2, t3, t4;

^ (For each team) ^

I tried this 'Math.max' thing, which I'm still new to, to get an idea of how inexperienced I am so far.

Example:

int first = Math.max(t1, t2);

int second = Math.max(t3, t4);

But that doesn't make total sense, because if:

(t1 = 5), (t2 = 4) , (t3 = 2), (t4 = 1)... than the qualified teams are 1 and 3, not 1 and 2, as it's supposed to be.

Thank you again for your time

- Keimic53

Re: How to find biggest two int. numbers from four

By the way, the points and fixtures are chosen randomly (Math.random)... although that is done.

Sorry for not advising you earlier.

Keep in mind also that two or more of the four teams may end up with the same points...

Thanks.

Re: How to find biggest two int. numbers from four

Quote:

two or more of the four teams may end up with the same points...

What is reported if that happens?

4 with same points

3 with same high points

2 with same high points

2 with same high and 2 with same second high points

2 with same second high points

etc

Re: How to find biggest two int. numbers from four

Quote:

Originally Posted by

**keimic53** Example:

int first = Math.max(t1, t2);

int second = Math.max(t3, t4);

There is nothing that says you can't feed the result of one max comparison, into another one.

Regards,

Jim