Fernando Z. answered 10/11/19
Patient Programming Tutor Specializing in C, Java, and Python
One way you can do it is to begin by creating the known values as either as constants or variables.
Once you have the first two values then it's a matter of multiplying the seconds in one year times the rate. Then you store the value. Since there are no actual variables you don't need to create a function. You would need a function or method in Java or C# but not in something like Python or JavaScript.
Above is the example in JavaScript. Now you would just print it to the screen.
Fernando Z.
10/11/19