Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Please answer the following question and show ALL work. Thanks! There are 2 arra

ID: 3773946 • Letter: P

Question

Please answer the following question and show ALL work. Thanks!

There are 2 arrays, one of integers and one of Strings, defined as follows: int numbers = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}; String words = {"one", "two", "three", "four", "five", "six", "seven", "eight", "nine", "ten"}; Write a Java program using one while loop that prints out numbers next to words, in exactly 10 lines, like this: one two three ... etc... Write a Java program that calls on a function called SumThree() that adds 3 integer numbers together and returns that sum. The program must call it like this: int x = SumThree(a, b, c); Let's say that a, b, and c are 4, 5, 6, respectively, then the program has to print out the following:

Explanation / Answer

Print the numbers using array
public class Main {
public static void main(String[] args) {
int[] num = {1,2,3,4,5,6,7,8,9,10};
int i = 0;
String[] word = {"one", "two", "three", "four", "five", "six","seven","eight","nine","ten"} ;
while(i < num.length)
{
   System.out.println(num[i] + " " + word[i]);
i++;
   }
}
}

Print the sum of digits
public class sum {
public static void main(String[] args) {
int a, b, c;
a=3;
b=4;
c=6;
int result = sum(a, b,c);
System.out.println("the sum of " + a + ", " + b + " and " + c + " is : " + result);
}

/** returns the minimum of two numbers */
public static int sum(int num1, int num2, int num3) {
int result = num1 + num2 + num3;

return result;
}
}