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
Create an algorithm that will convert dog years to human years using the assumption that 1 dog year = 7 human years. Prompt the
matrenka [14]

Answer:

Algorithm:

1. Declare and initialize variable one_dog_year=7.

2.Ask user to give dog age.

   2.1 Read the dog age and assign it to variable "dog_age".

3.Create a variable "human_age" to store the equivalent human age.

   3.1 Calculate equivalent human age as "human_age=one_dog_year*dog_age".

4.Print the equivalent human age of dog age.

7. End the program.

// here is algorithm implemented in c++

#include <bits/stdc++.h>

using namespace std;

int main()

{

   // initialize one dog year

   int one_dog_year=7;

   int dog_age;

   int equi_h_age;

   cout<<"Enter the dog age:";

   // read the dog age

   cin>>dog_age;

   

   //calculate the equivalent human age

   equi_h_age=dog_age*one_dog_year;

   cout<<"equivalent human age is : "<<equi_h_age<<endl;

return 0;

}

Output:

Enter the dog age:2                                                                                                                                            

equivalent human age is : 14

4 0
3 years ago
Which of the following statements is true according to the code?
mihalych1998 [28]

Answer:

The #intro style applies to all paragraphs.

Explanation:

It is a class

A class applyies to all with that name

5 0
4 years ago
________ management is a process of controlling changes in system requirements during software development.
Brums [2.3K]
<span>Change Control (CC) management is a process of controlling changes in system requirements during software development. </span>
8 0
3 years ago
A TV game show Jeopardy! contestant who uses a strategy to seek out the hidden Daily Double questions, which are usually the thr
jek_recluse [69]

Answer:

Game theory.

Explanation:

In the TV game show Jeopardy! Game theory allows contestant to use a strategy to seek out the hidden Daily Double questions, instead of the more common approach of selecting a single category and selecting questions gradually increasing in the degree of difficulty.

Game theory is the process of using mathematical model in the study of strategic interaction between two or more players in a game or situation having laid down rules and outcomes.

8 0
3 years ago
What will happen to the number of returns you get if you use the NOT Boolean operator in a search?
posledela
Smaller, as it removes search results.
7 0
4 years ago
Other questions:
  • Java
    13·1 answer
  • List at least five tasks a layer performs. Could one (or more) of these tasks could be performed by multiple layers?
    13·1 answer
  • Which of the following is the definition of Internet Protocol Security ( IPSec)? A remote access client/server protocol. It is a
    13·2 answers
  • What are the disadvantages of plasma display?
    9·1 answer
  • Assume that strikeCounter has already been declared to be a "pointer to int". Assume further that strikeCounter has been initial
    5·1 answer
  • Which entity might hire a Computer Systems Analyst to help it catch criminals?
    12·2 answers
  • Write a print statement that displays a random integer between 5 and 5000. Assume the random library is imported.
    12·1 answer
  • windows 93 it is a website THE QUESTION IS WHAT IS THE FIRST THING THAT POPS UP WHEN YOU OPEN THE WEBSITE?
    8·1 answer
  • The computer that can be used for performing the daily life tasks that might include emailing, browsing, media sharing, entertai
    11·1 answer
  • assuming the default gateway is connected to the internet, what type of internet access would this server have?
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!