Recursive Factorial Assignment

Since you have now learned about recursion in Java, now it’s time to put that knowledge to the test! Your job will be to implement a recursive method that will be able to calculate any given number’s factorial.

First off, if you don’t know what a factorial is, allow me to explain. A factorial is a calculation based on multiplying a given number by it’s decrementing values until you reach the number 1. The notation for this is a given number following by an exclamation mark. Let’s look at some examples, as they will make this explanation make sense:

Trevor, I just watched your video which shows your solution to this assignment(5) which included the use of an instance variable “total.” I had come up with the following which doesn’t require an instance variable and follows a little different logic than what you did. It passed your junit tests including the 5th one to make sure it’s recursive.