Create a method `new` that takes one number `usize` and initializes the struct `Number`.
Create a method `new` that takes one number `usize` and initializes the `Number` struct.
This method will have to determinate if the given number is even or odd.
This method will have to determinate if the given number is even or odd. If it is even you will have to increment it by one to the next odd number and if it is odd you have to increment by one to the next even number.
After that you will implement an iterator for the struct `Number` that returns a tuple (usize,usize,usize) containing each field of the struct Number.
After that you will implement an iterator for the struct `Number` that returns a tuple (usize,usize,usize) containing each field of the struct Number.
The first position of the tuple will be the even number, the second will be the odd number, and the third will be the factorial number.
The first position of the tuple will have the even numbers, the second will have the odd numbers, and the third will have the factorial numbers.
That being said, You will have to follow this rules:
- If the number is even you will have to calculate the factorial of the next odd number.
- If the number is odd you will have to calculate the factorial of the next even number.
- The tupple has to return all the numbers in the right positions.
So the purpose is to return the given number in the right position. If it is even it will be at the first position, and if it is odd it will be in the second position. Apart from that you have to return the factorial of the given number in the third position.
Example:
If `a = 5`, 5 is odd, the next even is 6, so the factorial of 6 is 720. Your program will return the following: