1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
drek231 [11]
3 years ago
14

Java

Computers and Technology
1 answer:
VARVARA [1.3K]3 years ago
5 0

Answer:

Here are the two statements which use nextInt() to print two random integers between 0 and 9:

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

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

Explanation:

Here is the complete program:

import java.util.Scanner;   //to accept input from user

import java.util.Random;   // use to generate random numbers

public class DiceRoll {  //class definition

public static void main (String [] args)  {//start of main function  

Random randGen = new Random();   // creates a Random class object randGen

int seedVal = 0;   //sets starting point for generating random numbers

randGen.setSeed(seedVal);   //sets the seed of random number generator

System.out.println(randGen.nextInt(10));  //generates and prints the first random integer between 0 and 9 (10 is the range from 0 to 9) using nextInt method, which is used to get next random integer value from the sequence of random number generator

System.out.println(randGen.nextInt(10));   //generates and prints the second random integer between 0 and 9 (10 is the range from 0 to 9) using nextInt method

return;    }  }

Another way to write this is to initialize two int variables:

int integer1;

int integer2;

Now use two print statements to print these random integers between 0 and 9 as:

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

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

Another way to write this is:

Set the value of integer1 to a random number from 0 to 9 and same for integer2

int  integer1 = randGen.nextInt(10);

int  integer2 = randGen.nextInt(10);  

Now use two print statements to print these random integers between 0 and 9 as:  

System.out.println(integer1);

System.out.println(integer2);

You might be interested in
Use ________ resolution when recording human speech in an audio file.
Reil [10]
<span>Use 8-bit resolution when recording human speech in an audio file.
</span><span>The </span>resolution<span> of </span>8 bits<span> can encode an analog input to one in 256 different levels. The reason why 256 levels is because 2^8</span><span> = 256.
</span>The analog to digital converter (ADC) <span> represents the analog input as a digital word.</span>
6 0
3 years ago
Can web sites contain copyright material? <br> Yes <br> No
Maru [420]
Yes they can contain copyright
6 0
3 years ago
Read 2 more answers
A strategy to solve a logic problem is to break it into steps. Using the drop-down menu, complete these sentences about solving
PSYCHO15rus [73]
I think the answer is 3!!
3 0
3 years ago
Read 2 more answers
Google Ads was constructed around three core principles, focused on helping businesses reach their online potential. The first o
PolarNik [594]

Answer:

True

Explanation:

Google Ads was constructed around three core principles, focused on helping businesses reach their online potential. The first of these is relevance. Google Ads connects businesses with the right people at the right time. The other principle is control and results.

7 0
3 years ago
Suppose that a program asks a user to enter multiple integers, either positive or negative, to do some calculation. The data ent
KatRina [158]

Answer:

d) An alphabetic character

7 0
3 years ago
Other questions:
  • Encryption is the process of:
    12·1 answer
  • A(n) ____________ is a program that translates a high-level language program into a separate machine language program.
    7·1 answer
  • Suppose your friend, who is a small business owner, wants to computerize her business functions such as accounting, payroll, and
    7·1 answer
  • A regular polygon is an n-sided polygon in which all sides are of the same length and all angles have the same degree (i.e.,the
    15·1 answer
  • Jemima is reviewing her history report and notices that her headings are not formatted the same throughout the
    7·1 answer
  • Write a method printshampoolnstructions0, with int parameter numCycles, and void return type. If numCycles is less than 1, print
    8·1 answer
  • What can you do to help create a safe online environment?
    8·2 answers
  • CORRECT ANSWER GETS BRAINLIEST
    8·2 answers
  • Menus are attached to the windows by calling
    15·1 answer
  • Which role will grant a delegate read-only access to a particular workspace within a user’s Outlook mailbox?
    15·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!