troubleshooting Question

redTicket challenge

Avatar of gudii9
gudii9Flag for United States of America asked on
JavaJava EEProgramming Languages-OtherProgramming
5 Comments3 Solutions169 ViewsLast Modified:
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;

  
}
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
ASKER CERTIFIED SOLUTION
krakatoa

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 3 Answers and 5 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 3 Answers and 5 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros