# greenTicket challenge

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

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

else{

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

else if((a==b)||(b==c)){
return 10;
}
else{
return 0;
}//inner else close

} //outer else close

}//method close

I am getting below result
Expected      Run
greenTicket(1, 2, 3) → 0      0      OK
greenTicket(2, 2, 2) → 20      20      OK
greenTicket(1, 1, 2) → 10      10      OK
greenTicket(2, 1, 1) → 10      10      OK
greenTicket(1, 2, 1) → 10      0      X
greenTicket(3, 2, 1) → 0      0      OK
greenTicket(0, 0, 0) → 20      20      OK
greenTicket(2, 0, 0) → 10      10      OK
greenTicket(0, 9, 10) → 0      0      OK
greenTicket(0, 10, 0) → 10      0      X
greenTicket(9, 9, 9) → 20      20      OK
greenTicket(9, 0, 9) → 10      0      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?
Java EEJavaProgramming Languages-OtherProgramming

Last Comment
gudii9

8/22/2022 - Mon
krakatoa

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
SOLUTION
ozo

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
gudii9

i wrote similar to above more elaborate

``````public int greenTicket(int a, int b, int c) {

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

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

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

else
return 0;

}
``````
gudii9