redTicket challenge

Hi,
I am working on below challenge
http://codingbat.com/prob/p170833
I tried my code as below
public int redTicket(int a, int b, int c) {

if((a==2)||(b==2)||(c==2))
{
return 10;
}

else{

if((a==b)&&(b==c)){
return 5;
}

else if((b!=a)&&(c!=a)){
return 5;
}
}

return 10;

  
}

Open in new window

I am getting below result
Expected      Run            
redTicket(2, 2, 2) → 10      10      OK         
redTicket(2, 2, 1) → 0      10      X         
redTicket(0, 0, 0) → 5      5      OK         
redTicket(2, 0, 0) → 1      10      X         
redTicket(1, 1, 1) → 5      5      OK         
redTicket(1, 2, 1) → 0      10      X         
redTicket(1, 2, 0) → 1      10      X         
redTicket(0, 2, 2) → 1      10      X         
redTicket(1, 2, 2) → 1      10      X         
redTicket(0, 2, 0) → 0      10      X         
redTicket(1, 1, 2) → 0      10      X         
other tests
X         

how to  improve my approach, results and design of this challenge. How do i make a graphical venn or flow chart or some other relevant diagram to design it before writing code to decide best strategy?
 Please advise
LVL 7
gudii9Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

krakatoaCommented:
return a+b+c==6?10:(a==b)&&(b==c)?5:b!=a&&c!=a?1:0;

Open in new window

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Member_2_1001466Commented:
as this is a challenge it should be done by yourself.
But as a hint, what about adding some console.log() statements to see, where it is and what decision it is taking?
awking00Information Technology SpecialistCommented:
return a==2&&b==2&&c==2 ? 10 : a==b&&a==c ? 5 : a!=b&&a!=c ? 1 : 0;
gudii9Author Commented:
public int redTicket(int a, int b, int c) {

if((a==2)&&(b==2)&&(c==2))
{
return 10;
}



else if((a==b)&&(b==c)){
return 5;
}

else if((b!=a)&&(c!=a)){
return 1;
}


return 0;

  
}

Open in new window


Expected	Run		
redTicket(2, 2, 2) → 10	10	OK	    
redTicket(2, 2, 1) → 0	0	OK	    
redTicket(0, 0, 0) → 5	5	OK	    
redTicket(2, 0, 0) → 1	1	OK	    
redTicket(1, 1, 1) → 5	5	OK	    
redTicket(1, 2, 1) → 0	0	OK	    
redTicket(1, 2, 0) → 1	1	OK	    
redTicket(0, 2, 2) → 1	1	OK	    
redTicket(1, 2, 2) → 1	1	OK	    
redTicket(0, 2, 0) → 0	0	OK	    
redTicket(1, 1, 2) → 0	0	OK	    
other tests
OK	    

Open in new window

i wrote similar to above more expanded code which passed all tests now.
main Mistake i did was used || instead of &&
krakatoaCommented:
Right.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Java

From novice to tech pro — start learning today.