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
What has the same mass as 0.25 mol of copper atoms?​
Tanzania [10]
????????????what is that
4 0
3 years ago
Write programs for money exchange. In these programs please:
Gennadij [26K]
D is the right answer I believe so
7 0
3 years ago
Cloud kicks recently completed the implementation of sales cloud. Cloud kicks has trained the users to use the mobile app to acc
aleksandrvk [35]

Answer:

see how long the people are on the app and see low long te time is constant where nobody is on at all

Explanation:

7 0
4 years ago
PLZ HELP 20 POINTS I REALLY NEED TO GET THIS RIGHT!
DIA [1.3K]

Answer:

B. 12

Explanation:

A4=A1+2

A1=10

10+2=12

A4=12

Ihope this helps

4 0
4 years ago
How do you make a triangle on art.kano.com
blsea [12.9K]

Umm, I guess you just try to do one? I don't know.. Sorry if I couldn't help out.

I believe you can do it!

7 0
3 years ago
Read 2 more answers
Other questions:
  • Who is demonstrating entrepreneurship?
    7·1 answer
  • We say that a sequence of numbers is a palindrome if it is read the same backward or forward. For example, the sequence: 6, 15,
    11·1 answer
  • Maya enjoys connectedWith her friends and social media apps but one of her friends post a lot of stuff that my thinks it’s annoy
    14·1 answer
  • This is important I need help please
    14·1 answer
  • Alice is an investor who has created a device controlled by an app that will water plants automatically. Alice has no experience
    9·1 answer
  • Ben is writing a paper for his college history class, and he wants to include some information he found on a Web site. What are
    5·1 answer
  • Does anyone know the name of the font :) ?
    14·2 answers
  • Match the protocols to their use. HTTP POP3 SMTP FTP You check email in your inbox. arrowRight You send an email to a friend. ar
    14·1 answer
  • Write a program that allows the user to enter three separate strings: a city name, a state name, and a ZIP code.
    5·1 answer
  • Why should we learn Ethereum? Explain.
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!