Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

iOS Object-Oriented Objective-C Diving Deeper - Classes, Properties and Methods Creating Methods!

Stefan Mach
Stefan Mach
3,691 Points

I botched this code challenge, please help

I tried this every which way, and the editor does not give any feedback. I put it into xcode, and it can't even tell it is a method, because I am guessing this code challenge has an answer that is correct in isolation in this context because it is a quiz, but cannot be tested in xcode because xcode wants the other code that supports the method. I am really stuck here, and have repeatedly watched the videos.

variable_assignment.mm
-(float)calculateTip:(float)subTotal, (float) tip{


tip = subTotal * 0.2;

  return;

}

1 Answer

james south
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
james south
Front End Web Development Techdegree Graduate 33,271 Points

well it looks like you are taking two arguments when you only need one, and you are not returning anything. so i think i would take tip out of the parameter list so that it only takes subtotal, then return tip as calculated. also it wants the parameter to be subtotal, not subTotal.