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
What is computer virus​
IRINA_888 [86]

Answer:

A type of malicious code or program written to alter the way a computer operates and is designed to spread from one computer to another.

Once a virus has successfully attached to a program, file, or document, the virus will lie dormant until circumstances cause the computer or device to execute its code. In order for a virus to infect your computer, you have to run the infected program, which in turn causes the virus code to be executed.

8 0
3 years ago
Read 2 more answers
What are the importance of computer in today's generation​
MariettaO [177]

Answer:

We use it everyday for all sorts of stuff

Explanation:

8 0
3 years ago
What is an example of a reference marker that a source might use? quotation print Web page numbering
olya-2409 [2.1K]

Answer

page numbering

Explanation

Page numbering is where the writer employs a process of applying sequence of numbers to pages of a certain document may it be a book, a magazine, a news paper or any other document having pages.The reference marker that a source might use a page numbering  to be able to reference details that are referenced in other details. By this it reduces complication

3 0
3 years ago
Read 2 more answers
You have the following code:
My name is Ann [436]

Answer:

7

Explanation:

We already have the functions that tells us how much to add. If you add all this, you will get 12. HOWEVER because cantaloupe is in the list, the computer does not count that. So if we add that again without 5(how much the cantaloupe costs), we get 7.

3 0
2 years ago
"A ____ is loosely defined as a very small device that has some built-in computing or Internet capability"
gizmo_the_mogwai [7]

Answer:

A mobile device is loosely defined as a very small device that has some built-in computing or Internet capability.

Explanation:

A mobile device also referred to as a handheld device is a computer device small enough to hold and operate in the hand.

Mobile devices can connect to the Internet and interconnect with other devices such as headsets through Wi-Fi, Bluetooth, cellular networks or near field communication (NFC).

Examples are: Smartphones, Tablets, Calculator , Digital media player , Handheld game console , Laptop , Mobile Internet Device (MID) , Personal Digital Assistant (PDA) , and Pocket calculator .

7 0
3 years ago
Other questions:
  • What is that tool that makes liquid metal? It is used for wires, Ik I might sound dumb but I'm rlly curious​
    7·1 answer
  • Can you plug a usb 2.0 into a 3.0 port on your computer
    12·1 answer
  • Which database item would show details such as a customer’s name, their last purchase, and other details about a customer
    14·2 answers
  • A cell has an unlimited number of conditions for Conditional Formatting.<br> A.true<br> B.false
    7·1 answer
  • _An electronic device used for processing data.
    10·2 answers
  • Write down the result of each expression in the output column and specify the datatype of the result.Datatype should follow the
    14·1 answer
  • Drag each label to the correct location on the image.
    7·1 answer
  • HELP AASAP BRAINLIEST JUST HELP
    13·1 answer
  • Types of network model​
    11·1 answer
  • . Which responsibility belongs to the marketing function?
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!