specialEleven java challenge

Hi,
I am trying below challenge

http://codingbat.com/prob/p100962

I tried as  below
public boolean specialEleven(int n) {

if(Integer.mod((n%11)==0))
return true;

else
return false;
  
}

Open in new window


I am getting below error


Compile problems:


Error:      if(Integer.mod((n%11)==0))
                 ^^^
The method mod(boolean) is undefined for the type Integer



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.

gudii9Author Commented:
public boolean specialEleven(int n) {

if((n%11)==0){
return true;
}

else{
return false;
}
  
}

Open in new window



above passed below test still many failures there
Expected	Run		
specialEleven(22) → true	true	OK	    
specialEleven(23) → true	false	X	    
specialEleven(24) → false	false	OK	    
specialEleven(21) → false	false	OK	    
specialEleven(11) → true	true	OK	    
specialEleven(12) → true	false	X	    
specialEleven(10) → false	false	OK	    
specialEleven(9) → false	false	OK	    
specialEleven(8) → false	false	OK	    
specialEleven(0) → true	true	OK	    
specialEleven(1) → true	false	X	    
specialEleven(2) → false	false	OK	    
specialEleven(121) → true	true	OK	    
specialEleven(122) → true	false	X	    
specialEleven(123) → false	false	OK	    
specialEleven(46) → false	false	OK	    
specialEleven(49) → false	false	OK	    
specialEleven(52) → false	false	OK	    
specialEleven(54) → false	false	OK	    
specialEleven(55) → true	true	OK	    
other tests
X	  

Open in new window


not sure on how to use mod method. Which object it is defined?
I saw one example here not sure how to use that in our context here

http://www.tutorialspoint.com/java/math/biginteger_mod.htm
0
ozoCommented:
public boolean specialEleven(int n) {
    return n%11<=1;
}
0

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
krakatoaCommented:
Or ...
  return 2>n%11;

Open in new window

0
Top Threats of Q1 & How to Defend Against Them

WEBINAR: Join WatchGuard CTO and our Threat Research Team on Aug. 2nd to hear the findings from our Q1 Internet Security Report! Learn more about the top threats detected in the first quarter and how you can defend your business against them!

Jim CakalicSenior Developer/ArchitectCommented:
Not the shortest but also correct:
  return n%11==0 || (n-1)%11==0;

Open in new window

0
krakatoaCommented:
Or,

return n%11-2<0;

Open in new window

0
gudii9Author Commented:
how do i say ignore sign whether it is positive or negative?
0
ozoCommented:
Math.abs

but you already have a given non-negative number
0
gudii9Author Commented:
Math.abs this is what i forgot and looking
0
gudii9Author Commented:
public boolean in1To10(int n, boolean outsideMode) {

if(n<=10&&n>=1 && outsideMode==false ){

return true;
}

else if(n<=1&&outsideMode==true){

return true;
}


else if(n>=10&&outsideMode==true){

return true;
}


  else 
  return false;
}

Open in new window


in the same lines i fixed my original code which passes all tests
0
krakatoaCommented:
You sure your last post was meant for this question?
0
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 EE

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.