Answer:
import java.util.Scanner;
import java.util.Arrays;
import java.util.Random;
public class Main {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
System.out.print("Enter low: ");
int low = scan.nextInt();
System.out.print("Enter high: ");
int high = scan.nextInt();
scan.close();
int rndnumbers[] = new int[10];
Random r = new Random();
for(int i=0; i<rndnumbers.length; i++) {
rndnumbers[i] = r.nextInt(high-low+1) + low;
}
for(int i=0; i<rndnumbers.length; i++) {
System.out.printf("%d: %d\n", i, rndnumbers[i]);
}
}
}
By being willing to communicate and troubleshoot.
Can you prove more information?
Answer:
You can assign a value to a routine variable in any of the following ways:
Use a LET statement.
Use a SELECT INTO statement.
Use a CALL statement with a procedure that has a RETURNING clause.
Use an EXECUTE PROCEDURE INTO or EXECUTE FUNCTION INTO statement.
Explanation:
Answer:
12. for (i = 0 ; i < testGrades.length ; i+=1 ){
13. if (testGrades[i] > 100){
14. sumExtra = sumExtra + testGrades[i] - 100;}
15. }
Explanation:
We first iterate through the entire testGrades array. For each test score that is in testGrades ( that is testGrades[i] ), we see whether or not the test grade is above 100 (See line 12) . If test grade is greater than 100, this means we have extra credit. We simply subtract 100 from the test grade, add it with the previous value of sumExtra and store the value back in sumExtra(see line 14). Once i is greater than the length of the test grades, the loop is exited. We can now print sumExtra to obtain the result.