Question: ntegers seedVal, lowBound and upBound are read from input. lowBound and upBound represent the minimum and maximum numbers of raisins to be put in each

ntegers seedVal, lowBound and upBound are read from input. lowBound and upBound represent the minimum and maximum numbers of raisins to be put in each basket, respectively. A total of 140 raisins are available. Complete the following tasks:
Call randGen's setSeed() with seedVal as the argument.
Assign variables basket1, basket2, basket3, and basket4 each with a random number of raisins between lowBound and upBound, both inclusive.
Assign variable remainingRaisins with 140 minus the sum of basket1, basket2, basket3, and basket4.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 remainingRaisins;
int lowBound;
int upBound;
int basket1;
int basket2;
int basket3;
int basket4;
seedVal = scnr.nextInt();
lowBound = scnr.nextInt();
upBound = scnr.nextInt();
System.out.println("Initial: 140");
/* Your code goes here */
System.out.println(basket1);
System.out.println(basket2);
System.out.println(basket3);
System.out.println(basket4);
System.out.println("Remainder: "+ remainingRaisins);
}
}

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!