id/email
password
forgot password | create account
about | help | code help+videos | done | prefs
CodingBat code practice

 

yearsFromMyAge


Create a method called int yearsFromMyAge(int theirAge) that when given the user's age it will return how many years they are from my age. Use Math.abs I am 45 now


yearsFromMyAge(2) → 43
yearsFromMyAge(80) → 35
yearsFromMyAge(45) → 0

...Save, Compile, Run (ctrl-enter)

public int yearsFromMyAge(int theirAge){ }

Editor font size %:
Shorter output


Forget It! -- delete my code for this problem

Progress graphs:
 Your progress graph for this problem
 Random user progress graph for this problem
 Random Epic Progress Graph

Java Help

Misc Code Practice

Copyright Nick Parlante 2017 - privacy