All of these problems are to be one in the same app. For each problem, create a button that executes your solution when clicked.
Some of these problems don't have user input. They start with hardcoded variables. Remember to test your solution with different values for these variables.
Question 1
You have an array of ints. Print the largest one. Your code should work regardless of the length of the array.
int[] data = {11,2,130,43,5};
// Write code to print largest number (in this case 130)
Question 2
Write a function named reverseArray that takes an array of integers named numbers as a parameter. The function should return an array with the numbers in reverse order.
Question 3
You have a number from the user. Print whether the number is a prime number or not.
A prime number is a number that can only be divided by itself and 1.
For example, 23 is a prime number, because its only factors are 23 and 1.
12 is not a prime number, because it can be divided by 1, 2, 3, 4, 6, and 12.
Tip: There are several steps to this problem, so break it down. What are the questions we need to answer? Make a function that achieves each of those questions.
Pick a number and walk through the process of determining for yourself whether the number is prime. What questions did you need to answer? Where are the loops in your logic?