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
pshichka [43]
2 years ago
14

Exercise : Randomizer In this exercise, we are going to create a static class Randomizer that will allow users to get random int

eger values from the method nextInt() and nextInt(int min, int max). Remember that we can get random integers using the formula int randInteger = (int)(Math.random() * (range + 1) + startingNum). nextInt() should return a random value from 1 - 10, and nextInt(int min, int max) should return a random value from min to max. For instance, if min is 3 and max is 12, then the range of numbers should be from 3 - 12, including 3 and 12.
Computers and Technology
1 answer:
Nutka1998 [239]2 years ago
4 0

Answer:

Here the code is by using java.

Explanation:

//Randomizer.java

public class Randomizer {

public static int nextInt() {

//get random number from 1-10

int randInteger = (int) (Math.random() * (11) + 1);

//if number is greater than 10 or less than 1

while (randInteger > 10 || randInteger < 1) {

randInteger = (int) (Math.random() * (11) + 1);

}

return randInteger;

}

public static int nextInt(int min, int max) {

//formula to get random number from min-max

int randInteger = (int) (Math.random() * (max + 1) + min);

while (randInteger > max || randInteger < min) {

randInteger = (int) (Math.random() * (max + 1) + min);

}

return randInteger;

}

}

//RandomizerTester.java

public class RandomizerTester {

public static void main(String[] args) {

System.out.println("Results of Randommizer.nextInt()");

for (int i = 0; i < 10; i++) {

System.out.println(Randomizer.nextInt());

}

int min = 5;

int max = 10;

System.out.println("\n Results of Randomizer.nextInt(5,10)");

for (int i = 0; i < 10; i++) {

System.out.println(Randomizer.nextInt(min, max));

}

}

}

OUTPUT:

Results of Randommizer.nextInt()

9

2

3

8

5

9

4

1

9

2

Results of Randomizer.nextInt(5,10)

9

8

9

7

5

10

5

10

7

7

You might be interested in
Mille gets a text from her friend asking if she wants to come over. It seems like a bit of a hassle to go to her friend's house,
Licemer1 [7]

Answer:

OC. It will be a more positive experience if she spends time with her friend in person.

Explanation:

You should always spend time with people in person rather than online whenever you get the chance.

8 0
1 year ago
Explain block diagram of. computer architure​
ozzi

Answer:

A block diagram is a diagram of a system in which the principal parts or functions are represented by blocks connected by lines that show the relationships of the blocks. They are heavily used in engineering in hardware design, electronic design, software design, and process flow diagrams.

Explanation:

In your question you asked architure but maybe it is architecture (•;

5 0
2 years ago
Write a program that reads a series of strings andprints only those strings beginning with the letter "b."
coldgirl [10]

Answer:

#include <iostream>

using namespace std;

int main()

{

char str[100][20];

int n;

cout<<"Strings you want to enter"<<endl;

cin>>n;

cout<<"enter n strings"<<endl;

for(int i=0;i<n;i++)

cin>>str[i];

for(int i=0;i<n;i++)

{

if((int)str[i][0]==98) //ascii value b is 98

cout<<str[i]<<endl;

}

return 0;

}

Explanation:

The above written code is for printing the strings which starts with the letter b.

To check if the string starts with a letter b we are checking the ascii value 98 which corresponds to b and then printing those strings.

6 0
3 years ago
A colleague has included you on an email that is irrelevant to you, but it continues to come to your inbox because people are us
Law Incorporation [45]

on google there is a mute function with the 3 dots on the top and outlook has it in the same location but under the word of "ignore"

7 0
3 years ago
Jen's house contains the following devices:
poizon [28]

Answer:

Jen's laptop and her daughter's phone, because they are both connected to the router and turned on.

Explanation:

A network comprises of two or more interconnected devices such as computers, routers, switches, smartphones, tablets, etc. These interconnected devices avail users the ability to communicate and share documents with one another over the network.

Additionally, in order for a network to exist or be established, the devices must be turned (powered) on and interconnected either wirelessly or through a cable (wired) connection.

Hence, the computers which are currently networked are Jen's laptop and her daughter's phone, because they are both connected to the router and turned on. A smartphone is considered to be a computer because it receives data as an input and processes the input data into an output (information) that is useful to the end user.

6 0
2 years ago
Other questions:
  • Which wireless technology has a typical transfer rate of 1 Mbps to 3 Mbps at distances up to about 10 meters?
    7·1 answer
  • Do you really think our life applications and OSs will be open source at the end for everything?
    11·1 answer
  • What major criteria must a product or process meet in order to be considered emerging technology?
    6·1 answer
  • Which element of a presentation program’s interface displays the slide you are currently creating or editing?
    14·2 answers
  • Which of the following is another type of brake system used in trucks
    5·1 answer
  • I neeeeeeeeeeeddddddddddddd help plz ppl
    10·2 answers
  • In theory, a hacker with a small but powerful directional antenna could access a wireless network from more than one mile away.
    7·1 answer
  • How does applying Fontworks effects to text on an advertising flyer change the text?
    14·2 answers
  • I dont know how to put the negative sigh on my computer
    5·2 answers
  • Assume that an int variable age has been declared and already given a value. Assume further that the user has just been presente
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!