Hint: This subroutine can take the given base as a parameter and the caculation result, percentage, as a return value. In this way, the return type for the subroutine can not be void any more.
Be careful with the declaration of your sequence. If you declare it as a local variable in main(), then you have to pass it as an argument to the subroutine. Otherwise, it has to be declared outside main().
Note: To make it simple, you can declare your subroutine in the same class as main(). If so, then it should be declared as a static function, i.e. it should begin with "public static".
Reference: The example of translation from celsius to fahrenheit. (the second one, which takes the translation as a subroutine with celsius as parameter and fahrenheit as return value)
Back to assignments index page