Question: Write the methods in JAVA for the following two questions. It is not necessary to write entire program. You only need to define the method
Write the methods in JAVA for the following two questions. It is not necessary to write entire program. You only need to define the method and call the method. When you call the method, you can use literal value as the argument value.
For example, //addTwo is a method which takes 2 integer arguments and return an integer. To call addTwo method as follows:
int sum = addTwo(10,12);
1. Write a method to generate a random number from10 to 50 and print the number after it is generated. The method name is generateRandomNum
The method returns nothing
The method takes no argument
The method will generate 10 random numbers in the range of 10-50 inclusive and print each random number right after it is generated.
2. Write a method to check if a number is even.
The method name is isEven
The method returns a boolean value
The method takes one integer argument
The method will check if the number passed in is even number. If it is even number, return true, otherwise return false
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
