Java程序辅导

C C++ Java Python Processing编程在线培训 程序编写 软件开发 视频讲解

客服在线QQ:2653320439 微信:ittutor Email:itutor@qq.com
wx: cjtutor
QQ: 2653320439
For Java lab 10 CS110 Lab # 10 Introduction to the for loop Part I For the for loop below, name the loop counter? How many iterations are there in this loop? Hand trace this segment of code showing the output from each loop. What does the final output look like? for (int i = 1; i <= 5; i++)     System.out.println("Hello"); For the for loop below, name the loop counter. How many iterations are there in this loop? Hand trace this segment of code showing the output from each loop. What does the final output look like? for (int count = 1; count < 4; count++)     System.out.println("telly"); For the for loop below, name the loop counter. How many iterations are there in this loop? Hand trace this segment of code showing the output from each loop. What does the final output look like? for (int k = 1; k <= 5; k += 2)     System.out.println("RED"); For the for loop below, name the loop counter and identify its class. How many iterations are there in this loop? Hand trace this segment of code showing the output from each loop. What does the final output look like? for (char c = 'a'; c != 'd'; c++)     System.out.println(c); How many iterations are there in the loop shown below? Hand trace this segment of code showing the output from each loop. What does the final output look like? for (int i = 1; i < 7; i++)     System.out.print("\n" + i + " " + (i + 1)); How many iterations are there in the loop shown below? Hand trace this segment of code showing the output from each loop. What does the final output look like? for (int i = 6; i > 0; i--)     System.out.print("\n" + i*i ); How many iterations are there in the loop shown below? Hand trace this segment of code showing the output from each loop. What does the final output look like? for (int i = 6; i <= 6; i++)     System.out.println("Hello"); How many iterations are there in the loop shown below? Hand trace this segment of code showing the output from each loop. What does the final output look like? for (int i = 6; i <= 5; i++)     System.out.println("White"); How many iterations are there in the loop shown below? Hand trace this segment of code showing the output from each loop. What does the final output look like? for (int i = 1; i <= 10; i++) {     System.out.println(i);     i++; } What output is produced by the following code? int i = 0; for ( ; i <= 3; ++i)     System.out.print("\n" + i*i); What output is produced by the following code? int i = 4; for ( ; ; ++i) {     System.out.print("\n" + i*i);     if (i == 6) break; } What output is produced by the following code? for ( ; ;) {     System.out.print("GREEN"); } What output is produced by the following code? int i = 4; for ( ; ;) {     System.out.println("RED");     if (i == 4) break; } What output is produced by the following code? final int MAXCOUNT = 5; int x = 0; for (int i = 1; i <= MAXCOUNT; i++) {     if (i == 2 || i == 4)         x= x + 2 * i;     else         x= x + i; } System.out.println("x = " + x ); What output is produced by the following code? final int MAXCOUNT = 50; for (int i = 1; i <= MAXCOUNT; i++) {     if (!(i % 5))         System.out.println("The number " + i ); } Assuming that number is an integer variable initialized to 1, show the output produced by the following loop. for (;;) {     if (number > 100)         break;     System.out.println( number );     number *= 2; } Part 2 Write a method that receives a positive integer n and displays the squares of the first npositive integers in decreasing order. Write a method that receives a positive integer n and uses a for loop to display the multiples of 5 from 5 to n. Write a method that uses a for loop to display all the uppercase consonants in the alphabet. Write a method that receives a char value of a lowercase letter of the alphabet. This method should use a for loop to display all the lowercase letters of the alphabet, except the letter passed as a parameter. Write a method that prompts the user for 10 positive integers and returns the sum. Reject all invalid integers. Write a method that receives a parameter for an integer between 4 and 10 and returns the sum of the integers from that parameter through 20. Write input method that prompts the user for a positive number between 5 and 10. Validate input and allow the user to re-input their number until it is valid. Do NOT end the loop until the input is correct. Have the method return the valid number iput by the user.