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
Allushta [10]
2 years ago
12

Create a method called randomValues that uses a while loop to generate a random number between 1-25 until the value 10 is genera

ted. Therefore, 10 will be the value that stops your loop from generating a random number.
Computers and Technology
1 answer:
ahrayia [7]2 years ago
3 0

Answer:

The method in Java is as follows:

public static void randomValues(){

    Random r = new Random();

    int sentinel = 10;

    int randNum = r.nextInt(24) + 1;

    while(randNum!=sentinel){

        System.out.print(randNum+" ");

        randNum = r.nextInt(24) + 1;

    }

    System.out.print(sentinel);

}

Explanation:

This defines the method

public static void randomValues(){

This creates a random object, r

    Random r = new Random();

This sets the sentinel value to 0

    int sentinel = 10;

This generates a random number

    int randNum = r.nextInt(24) + 1;

This loop is repeated until the the random number is 10

    while(randNum!=sentinel){

Print the generated number

        System.out.print(randNum+" ");

Generated another random number

        randNum = r.nextInt(24) + 1;     }

Print the sentinel (i.e. 10)

    System.out.print(sentinel);

}

You might be interested in
Which command on the Insert tab of the PowerPoint Online application is used to add a Venn diagram or process chart to a present
Setler [38]

The command to add a Venn Diagram or a process chart on PowerPoint Online is to select the Insert tab, then select the SmartArt button, and there is the process charts listed under Process. But the Venn Diagram is listed under List.

7 0
3 years ago
Read 2 more answers
Is backing up computer files done on the hard drive?
melomori [17]
Yes I believe so 

It should be acked up on the hard drive
7 0
3 years ago
Which of these statements most accurately describes cookies?
horsena [70]
A cookie(s), on a website, is a small text file that is placed on a computer by a website. Most websites online use cookies to track data. A person can turn off their cookie tracking by going into the settings and turning it off. You can directly choose to not have cookies placed on your computer or phone. However, some website does require the cookies to be enabled before you can visit the website. The correct answer will be C. 
5 0
3 years ago
What are two reasons a network administrator would use cdp.
Ulleksa [173]

Answer:

To obtain VLAN information from directly connected switches. To determine the status of network services on a remote device. To determine the status of the routing protocols between directly connected routers .

Explanation:

6 0
2 years ago
What is the answers please
Gre4nikov [31]
which question are u referring too
6 0
3 years ago
Other questions:
  • Write a for loop to print all elements in courseGrades, following each element with a space (including the last). Print forwards
    7·1 answer
  • I want to customize my company's logo, name, address, and similar details in all my business documents what option should use?
    12·1 answer
  • What is software that helps a computer operate efficiently and keeps track of data on a computer?
    14·1 answer
  • What is the gauge manifold made of
    14·1 answer
  • .What particular skills does a team leader need in addition to the other skills needed by any team member. (choose all that appl
    6·1 answer
  • Please as soon as possible
    13·1 answer
  • What is malware? a type of virus that spreads through a network connection a type of virus that targets programs and files any p
    8·1 answer
  • Write a program that computes how much each person in a group needs to pay (after tax and tip) when splitting the bill equally.
    5·1 answer
  • nts/viewer/classes/289ef1a5d7c341c284010 Select the compound inequality shown on the graph. 5 4 3 2 1 0 1 2 를 4​
    6·1 answer
  • All Office programs have similar commands on the tab for changing the document view a. File b. View c. Locate d. display ​
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!