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
Pepsi [2]
3 years ago
13

Type two statements using nextInt() to print two random integers between (and including) 0 and 9. End with a newline. Ex: 5 7 No

te: 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)
Computers and Technology
2 answers:
MArishka [77]3 years ago
5 0

Answer:

import java.util.Random;

public class RandomGenerator

{

public static void main(String[] args) {

Random randomGenerator = new Random();

       int seed = 0;

       randomGenerator.setSeed(seed);

       

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

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

}

}

Explanation:

In order to create random number using java.util.Random class, we need to create an object from the class, set a seed value, and  call the appropriate function. In this case, the object is created as <u>randomGenerator</u>, the <u>seed value</u> is set to 0. To create the integers, we need to use <u>nextInt()</u>. This function <u>takes one parameter to specify the range, and creates a number between 0 and given number (</u>given number is not included<u>)</u>. Since, it is asked to create integers between 0 and 9, we should pass 10 as a parameter.

8_murik_8 [283]3 years ago
3 0

Answer:

random1 = randGen.nextInt(10);

random2 = randGen.nextInt(10);

The value of 10 as a scaling factor is used because counting 0 - 9 inclusive, we have 10 possibilities.

Explanation:

// Random class is imported to allow the program generate random object

import java.util.Random;

//The class definition

public class Solution {

   // main method is defined which signify beginning of program execution

   public static void main(String[ ] args) {

       // Random object called randGen is declared

       Random randGen = new Random();

       // random variable 1

       int random1;

       // random variable 2

       int random2;

       // random1 is generated and printed

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

       // random2 is generated and printed

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

   }

}

You might be interested in
Which of the following is a locate tool that will enable you to navigate to cell M291?
scoundrel [369]

just answered it its<u><em> Go To</em></u>

3 0
4 years ago
Sometimes a virus will disable a system’s antivirus protection or add exceptions which prevent its being detected. Running an an
nikklg [1K]

Answer:

A boot-up CD or a USB

Explanation:

6 0
4 years ago
When a program lets the user know that an invalid menu choice has been made, this is an example of?
kolezko [41]

The question has the multiple choices below

A) Input validation
B) output correction
C) compiler criticism
D) output validation

The answer is (A) Input validation

Also known as data validation, it is the correct and proper testing of any input supplied by an application or a user. It prevents wrongly formed data from entering the system. Applications should be able to check and validate every input entered into the system since it is hard to detect a malicious user trying to gain entry into software.










5 0
3 years ago
Sam has created a fashion website. There are many subscribers to his website. He has added new blogs, pictures, and articles abo
marusya05 [52]

Answer:

Post advertisements on social media and message the subscribers.

Explanation:

There is no point in not promoting and putting forward the work that he has been doing. All of the given options are about promoting the content but Sam needs to choose the ones which are efficient and seem professional as well.

Posting advertisements about the website promotes the content on a wider base and helps in luring more and more people to the website.

Messaging or sending an email to the subscribers is a healthy of letting the subscribers about the updates and latest posts.

8 0
4 years ago
Write a statement that reads 5 successive integers into these variables that have already been declared: x1, x2, x3, x4, x5. The
prisoha [69]

Answer:

Following are the statement in C++ language :

#include <iomanip> // header file  

using namespace std; // namespace

int main() // main method  

{

   int x1,x2,x3,x4,x5; // variable declaration

cout<<" Enter the 5 sucessive integer:";

cin>>x1>>x2>>x3>>x4>> x5; // taking 5 input from user

cout<<right;

// prints each  of  its own line and form a right-justified  

cout<<setw(5)<< x1 << "\n" << setw(5) << x2 << "\n" <<setw(5) << x3 << "\n" << setw(5) << x4 << "\n" << setw(5) << x5 << "\n";

return(0);    

}

Output:

Enter the 5 sucessive integer: 45

23

445

6

8

 

  45

  23

 445

   6

   8

Explanation:

Description of program is given below  

  • Declared a 5 integer value x1,x2,x3,x4,x5 respectively.
  • Read the 5 integer value from user by using cin funtion.
  • Finally Print these 5 value in its own line and form a right-justified by using setw() function on it
5 0
3 years ago
Other questions:
  • To evaluate trends in the workforce, investigate
    14·1 answer
  • While designing web pages for mobiles, the page content should be extensive such that the readers get the opportunity to explore
    5·2 answers
  • Alpha Technologies, a newly established company, wants to share information about its work with people all over the world. Which
    9·1 answer
  • Drag the tiles to the correct boxes to complete the pairs.
    8·2 answers
  • __________ refers to the idea that eachemployee should report
    14·1 answer
  • You can use a 32-bit processor to install the hyper-v role as long as it supports virtualization extensions. true or false
    5·1 answer
  • 87. Labor Department surveys show a close relationship between job<br> security and
    9·1 answer
  • What are software applications?
    14·1 answer
  • A computer-based information system that keeps track of the transactions needed to conduct business is a(n) ________ system.
    9·1 answer
  • joe is in the planning stages to make sure that an upcoming company promotion during a major sporting event will not overwhelm h
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!