Function Snacks
Function Snacks
1. isEven(integer) -> boolean: Write a function that takes an integer and returns true if the
integer is even and returns false if the integer is odd.
2. isPrimeNumber(integer)-> boolean: Write a function that takes an integer and returns
true if the number is a prime number and returns false if it is not a prime number.
3. subtract(integer, integer)-> integer: Write a function that takes 2 integers and returns the
positive difference irrespective of the parameter order. ie 3, 7 and 7, 3 should return 4.
4. divide(integer, integer)-> float: Write a function that takes 2 integers and returns the
quotient. If the second integer is 0 (zero). please return 0 as your quotient.
5. factorOf(integer)-> integer: Write a function that takes an integer and returns the number
of factor for the integer. ie, if the function takes in 10, it should return 4 because factors of 10
are 1,2,5,10.
6. isSquare(integer)->boolean: Write a function that takes an integer and returns true if the
integer is a square number. ie if I pass in 25, the function should return true.
8. factorialOf(integer)-> long: Write a function that takes an integer and returns the
factorial of the number. If I pass in 5, i expect 120 (5 * 4 * 3 * 2 *1).
9. squareOf(integer) -> long: Write a function that takes an integer and returns the square
of the number. if I pass in 5, i expect 25(5 * 5).
You can google the mathematics terms used in this assignment to gain clarity before doing
the tasks.
Create a class called Kata and create all of the functions in the class.
Submission instruction: push the code alongside your existing code to github and add me
as a contributor (my handle is i-am-chibuzo).
PS: This snack is not a group snack, DO NOT SHARE.
Enjoy your short weekend