Question: What is the code in java? Excercise 1 Generate 30 random numbers from the following range: {-3, -2, -1, 0, 1, 2, 3, 4, 5,
What is the code in java?
Excercise 1
Generate 30 random numbers from the following range: {-3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8} ( 6 points ) For each of the numbers do the following: ( 6 points ) If it is a negative number print the string neg otherwise print the number itself (6 points ) However, it is a multiple of 4 (0, 4, 8) do NOT print the number. Instead print @@ ( 6 pts ) Notice that the output varies in length (one digit numbers, two characters @@ and three characters neg) To produce a neat output use left aligned columns of width 6 (see sample output below). ( 6 points ) Each row should have exactly 6 columns ( 6 points ) When you are done displaying the numbers print all done ( 5 points ) It should be printed below the other output separated by a single line. Below you can see a sample result. Because the numbers are random your output is likely to look different
String toLowerCase() Converts all of the characters in this String to lower case using the rules of the default locale.
Sample Output 6 7 neg @@ neg neg neg 6 neg 2 1 @@ 2 6 2 6 3 6 neg @@ 1 @@ 7 1 7 7 7 neg @@ neg all done
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
