Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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.

-(float)calculateTip:(float)subTotal, (float) tip{

tip = subTotal * 0.2;



1 Answer

james south
.a{fill-rule:evenodd;}techdegree seal-36
james south
Front End Web Development Techdegree Graduate 33,258 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.