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

java as bigener please 1. What does the following segment of code print out? int

ID: 3923771 • Letter: J

Question

 java as bigener please  1. What does the following segment of code print out?       int s = 1;      int n;      for(n = 1; n <= 5; n++)      {         s += n;         n++;      }      System.out.println("s = " + s);          System.out.print("n = " + n);                      2. Convert the following "for" loop to a "while" loop:       int x;      for(x = 10; x >= 0; x--)      {         System.out.println( x + " seconds to go.");      }    3. What is printed by the following segment of Java code?       int j = 1;      while(j < 3);      {          System.out.println(j);          j++;      }      System.out.println("Final j = " + j);                                      4. What does the following segment of code print out?     int i = 4;     do     {                 System.out.println("iteration " + i);                 i--;     } while(i > 4);                            5. What will be the output of the nested loop below?      int height = 3, width = 4;              for(int i = 1; i <= height; i++)     {        for(int j = 1; j <= width; j++)        {           System.out.print("*");        }        System.out.println();     } 

Explanation / Answer

Question 1:

Answer:

s = 10
n = 7

Question 2:

Answer:

10 seconds to go.
9 seconds to go.
8 seconds to go.
7 seconds to go.
6 seconds to go.
5 seconds to go.
4 seconds to go.
3 seconds to go.
2 seconds to go.
1 seconds to go.
0 seconds to go.

Question 3:

Answer:

1
2
Final j = 3

Question 4:

Answer:

iteration 4

Question 5:

Answer:

****
****
****