Question: import java.util.Random; import java.util.Scanner; public class GenerateRandomNumbers { public static void main ( String [ ] args ) { Scanner scnr = new Scanner (

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 sumRolls;
int maxValue;
int roll1;
int roll2;
int roll3;
seedVal = scnr.nextInt();
maxValue = scnr.nextInt();
roll1= randGen.nextInt(maxValue)+1;
roll2= randGen.nextInt(maxValue)+1;
roll3= randGen.nextInt(maxValue)+1;
sumRolls = roll1+ roll2+ roll3;
System.out.println(roll1);
System.out.println(roll2);
System.out.println(roll3);
System.out.println("Sum: "+ sumRolls);

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!