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]
3 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]3 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
Java-Script Concept quiz:
In-s [12.5K]

Answer:

Explanation:

1) the versions of JavaScript that are fully supported by all modern browsers ( Except internet explorer 9) are:

C. ECMAScript 3, ECMAScript 5

2) JavaScript is used to implement complex features on a_____

A. web page

3) computer programming tools that are used to store data are called____

C. variables

4) var name = Scott; is the code to create a ____ called "Scott"

D. None of the above

Scott is a variable

5) the key difference between "var" and "let" variables is that____

D. None of the above  

let is used to redefine a variable by using var to redefine may cause problems

6) Hoisting in JavaScript is the process whereby declarations get moved to the____

C. top

7) Im JavaScript, "/ /" is used to code____

A. comments

8) ______ data types have two potential values - true and false.

D. None of the above

Boolean is the data type and null is always false

9) Using ____ gives coders the ability to query data set data to create blueprints.

C. consoles

The Console object provides access to the browser's debugging console.

5 0
3 years ago
Suppose we perform a sequence of n operations on a data structure such that if some condition C(k) holds then the kth operation
GrogVix [38]

Answer:

stay home, stay safe, dont get corona virus

Explanation:

7 0
3 years ago
Can someone pelaseee help
aalyn [17]

Answer:

Explanation:

develloppemetn de grace en option est logiquement une biologiste experimenter des annes 1256 a toulouse en france

6 0
2 years ago
Ross has to create a presentation for his class but can't decide on a topic. What should he do?
mylen [45]
Resheach thngs that instrest him and that fit the guidlines
6 0
3 years ago
Read 2 more answers
What are the advantages and disadvantages of the simulated link strategy?
amid [387]

Answer:

The advantage of the simulated link strategy are:

  • It is easily able to provide the practical feedback to the customers and users while designing the whole system. It also determine the efficiency and the correctness of the design in the stimulated link strategy.
  • In the stimulated link strategy, the sharing and delivering of the data and information is done efficiently without any occurrence of error and interrupt. It is also high flexible technique.

The disadvantage of the simulated link strategy are:

  •   The simulated link strategy is flexible but it is not standardization and also it required more good concept.
  •  This technique is expensive and it is not readily available as it always require validation process.

3 0
3 years ago
Other questions:
  • Which of the following are types of home internet service? Check all that apply
    7·1 answer
  • What are the three business writing formats
    12·1 answer
  • Does functionality provided by the app play an important role in a decision to
    13·1 answer
  • A group of users is unable to connect to the network. When testing several of the PCs and issuing the command ipconfig, the tech
    10·1 answer
  • The used of PPE in the shop includes the following, except:
    10·2 answers
  • What is the largest value that can be represented by 6 binary digits? .
    5·1 answer
  • When an organizatin needs a program to do a very specific job, it mayhire someone to write _____ software.​
    10·1 answer
  • You can use this keyboard shortcut to toggle the visibility of the command line. If for some reason your command line is hidden
    7·1 answer
  • Which of these is a type of social engineering attack?
    10·1 answer
  • The process of getting listing information displayed on numerous other websites is:________
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!