Menu

[Solved]Javascript Coding Netbeans Please Answer 6 Questions 1 Consider Code Output Program Prod Q37030902

in javascript coding (netbeans) please answer the 6 Questionsbelow:

1). Consider the code below. What is the output the programproduces?

/** A simple program that prints a loop control variable.*/public class SimpleLoop{ public static void main(String[] args) { int i = 0; int limit = 6; while (i < limit) { System.out.println(“i = ” + i); i++; } }}

Solution:

2). Consider the code below again. What happens if you commentout the line that increments i? Will the program ever stoplooping?

/** A simple program that prints a loop control variable.*/public class SimpleLoop{ public static void main(String[] args) { int i = 0; int limit = 6; while (i < limit) { System.out.println(“i = ” + i); i++; } }}

Solution:

3) Write a program that uses a while loop. In eachiteration of the loop, prompt the user to enter a number –positive, negative, or zero. Keep a running total of the numbersthe user enters and also keep a count of the number of entries theuser makes. The program should stop whenever the user enters “q” toquit. When the user has finished, print the grand total and thenumber of entries the user typed.

Solution:

4). You can test to see if an integer, x, is even or odd usingthe Boolean expression (x / 2) * 2 == x. Integers that are evenmake this expression true, and odd integers make the expressionfalse.

Use a for loop to iterate five times. In eachiteration, request an integer from the user. Print each integer theuser types, and whether it is even or odd. Keep up with the numberof even and odd integers the user types, and print “Done” whenfinished, so the user won’t try to type another integer. Finally,print out the number of even and odd integers that wereentered.

Solution:

5). Use nested for loops to produce the followingoutput

     1     1

     1     2

     1     3

     1     4

     2     1

     2     2

     2     3

     2     4

Let the outer loop print the numbers in the left column, and theinner loop print the numbers in the right column. In eachiteration, print the loop control variables to produce theoutput.

Solution:

6). Use nested for loops to produce the followingoutput:

X

XX

XXX

XXXX

XXXXX

Solution:

Expert Answer


Answer to in javascript coding (netbeans) please answer the 6 Questions below: 1). Consider the code below. What is the output the… . . .

OR


Leave a Reply

Your email address will not be published. Required fields are marked *