Create a method `new` that takes one number `usize` and initializes the `Number` struct.
Create a method `new` that takes one number `usize` and initializes the struct `Number`.
This method will have to determinate if the given number is even or odd, if it is even you will have to increment one to the odd number and
if it is odd you have to increment one to the even number.
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.
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.
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.
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.
For this exercise you will have to create a [projectile motion](https://cimg2.ck12.org/datastreams/f-d%3Abb024be6673110b31e78b46819e792adaed8dc661e082a61f0a6d64e%2BIMAGE%2BIMAGE.1).
You will be provided with a structure called `Object` that will have all variables that are
A structure called `Object` will be provided which will have all variables that are
essential for the projectile physics. (distance, velocity, height, time)
You must implement :
- A function `throw_object` that will initialize the Object with a given velocity and height.
- The trait Iterator with the `.next()` in which it must calculate the next position of the object after 1 second.
It will return an `Option` with the Object, It will return `None` if the object already reached the floor.
- The trait Iterator with the `.next()` in which,the next position of the object after 1 second, must be calculated.
It will return an `Option` with the Object or it will return `None` if the object already reached the floor.
- Create an Iterator (by implementing the `std::iter::Iterator` trait) that iterates through the values from `beg` to `end` (including end) in the indicated `steps`.
- Create an `Iterator` (by implementing the `std::iter::Iterator` trait) that iterates through the values from `beg` to `end` (including end) in the indicated `steps`.
- The name of you're iterator will be `StepIterator` and it must be generic so you can use any integer value: i8,..,i64, u8,..,u64 or floating point number f32,..,f64
- The name of your iterator will be `StepIterator` and it must be generic so you can use any integer value: i8,..,i64, u8,..,u64 or floating point number f32,..,f64
- If the steps don't allow to arrive until the end of the sequence only the last value inferior to the end of the series will be returned (See Usage)
- If the steps do not allow to attain the end of the sequence, only the last value inferior to the end of the series will be returned (See Usage)
- Define the associated function: `new`that creates a new Step iterator:
- Define the associated function: `new`which creates a new Step iterator:
### Expected Functions and Structures
@ -32,6 +32,8 @@ impl std::iter::Iterator for StepIterator<T> {