Question: Integers seedVal and upperLimit are read from input. randGen.setSeed ( ) is called with seedVal as the seed. Assign variables sample 1 , sample 2

Integers seedVal and upperLimit are read from input. randGen.setSeed() is called with seedVal as the seed. Assign variables sample1, sample2, sample3, and sample4 each with a random number between 0 and upperLimit -1, both inclusive. import java.util.Random;
import java.util.Scanner;
public class GenerateRandomNumbers {
public static void main(String[] args){
Scanner scnr = new Scanner(System.in);
Random randGen = new Random();
int seedVal;
int sum;
int upperLimit;
int sample1;
int sample2;
int sample3;
int sample4;
seedVal = scnr.nextInt();
upperLimit = scnr.nextInt();
randGen.setSeed(seedVal);
/* Your code goes here */
sum = sample1+ sample2+ sample3+ sample4;
System.out.println(sample1);
System.out.println(sample2);
System.out.println(sample3);
System.out.println(sample4);
System.out.println("Sum: "+ sum);
}
}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!