# Selection Match Result

Page 1 of 1

## 4 Replies - 275 Views - Last Post: 09 November 2017 - 04:19 AMRate Topic: //<![CDATA[ rating = new ipb.rating( 'topic_rate_', { url: 'https://www.dreamincode.net/forums/index.php?app=forums&module=ajax&section=topics&do=rateTopic&t=407475&amp;s=7250c288e1dfbe081b9fc554e3b0d020&md5check=' + ipb.vars['secure_hash'], cur_rating: 0, rated: 0, allow_rate: 0, multi_rate: 1, show_rate_text: true } ); //]]>

### #1 JeremyGardel

Reputation: 0
• Posts: 3
• Joined: 09-November 17

# Selection Match Result

Posted 09 November 2017 - 03:22 AM

```package match.result;

import java.util.Scanner;

/**
*
* @author Jeremy
*/
public class MatchResult {

public static void main(String[] args)
{
String a;
String b;
String c;
String d;
String e;
Scanner in = new Scanner(System.in);
System.out.println("Please, Enter your Match results down here: > Selection from ( A, B, D )");
a = in.nextLine();
b = in.nextLine();
c = in.nextLine();
d = in.nextLine();
if(a.equals("A") && b.equals("A") && c.equals("A") || d.equals("A"))
{
//e = in.nextLine();
System.out.println("Team A is the winner.");
}
else if(a.equals("A") && b.equals("A"))
{
System.out.println("No winners.");
}
else if(a.equals("D") && b.equals("D"))
{
System.out.println("No winners.");
}
else
{
System.out.println("No Winner.");
}

```

I want at the result here
```         if(a.equals("A") && b.equals("A") && c.equals("A") || d.equals("A"))
{
//e = in.nextLine();
System.out.println("Team A is the winner.");
}

```

When Entry letter A has the largest count, then A is the winner
Note: this code isn't right, When I type A,A,B,B " It says A is winner but the result must be no winner".

Is This A Good Question/Topic? 0

## Replies To: Selection Match Result

### #2 g00se

• D.I.C Lover

Reputation: 3550
• Posts: 16,190
• Joined: 20-September 08

## Re: Selection Match Result

Posted 09 November 2017 - 03:42 AM

Quote

When Entry letter A has the largest count, then A is the winner

In that case, why are you not counting the entries?

### #3 JeremyGardel

Reputation: 0
• Posts: 3
• Joined: 09-November 17

## Re: Selection Match Result

Posted 09 November 2017 - 03:45 AM

g00se, on 09 November 2017 - 10:42 AM, said:

Quote

When Entry letter A has the largest count, then A is the winner

In that case, why are you not counting the entries?

mm, Gimme an example so I can try doing it

### #4 g00se

• D.I.C Lover

Reputation: 3550
• Posts: 16,190
• Joined: 20-September 08

## Re: Selection Match Result

Posted 09 November 2017 - 03:53 AM

```int[] scores = new int[4];

// (in a loop)
char entry = in.nextLine().charAt(0);
scores[entry-'A']++;
```

### #5 JeremyGardel

Reputation: 0
• Posts: 3
• Joined: 09-November 17

## Re: Selection Match Result

Posted 09 November 2017 - 04:19 AM

g00se, on 09 November 2017 - 10:53 AM, said:

```int[] scores = new int[4];

// (in a loop)
char entry = in.nextLine().charAt(0);
scores[entry-'A']++;
```

Thanks +reped