Sovi.AI - AI Math Tutor

Scan to solve math questions

QUESTION IMAGE

challenge activity 2 18 2: get random numbers. type two statements usin…

Question

challenge activity 2 18 2: get random numbers. type two statements using nextint() to print two random integers between (and including) 0 and 9. end with a newline. ex: 5 7 note: for this activity, using one statement may yield different output (due to the interpreter calling randgen.nextint() in a different order). use two statements for this activity. (notes) see how to use zybooks for info on how our automated program grader works. 1 import java.util.scanner; 2 import java.util.random; 3 4 public class diceroll { 5 public static void main(string args) { 6 scanner scnr = new scanner(system.in); 7 random randgen = new random(); 8 int seedval; 9 10 seedval = scnr.nextint(); 11 randgen.setseed(seedval); 12 13 / your solution goes here / 14 15

Explanation:

Step1: Print first random integer

System.out.println(randGen.nextInt(10));

Step2: Print second random integer

System.out.println(randGen.nextInt(10));

Answer:

System.out.println(randGen.nextInt(10));
System.out.println(randGen.nextInt(10));