Answer:
The solution code is written in Java.
- public class Main {
-
- public static void main(String[] args) {
-
- Scanner inNum = new Scanner(System.in);
- System.out.print("Enter number of toss: ");
- int num = inNum.nextInt();
-
- for(int i=0; i < num; i++){
- System.out.println(toss());
- }
- }
-
- public static String toss(){
- String option[] = {"heads", "tails"};
- Random rand = new Random();
- return option[rand.nextInt(2)];
- }
- }
Explanation:
Firstly, we create a function <em>toss()</em> with no parameter but will return a string (Line 14). Within the function body, create an option array with two elements, "heads" and "tails" (Line 15). Next create a Random object (Line 16) and use <em>nextInt()</em> method to get random value either 0 or 1. Please note we need to pass the value of 2 into <em>nextInx() </em>method to ensure the random value generated is either 0 or 1. We use this generate random value as an index of <em>option </em>array and return either "heads" or "tails" as output (Line 17).
In the main program, we create Scanner object and use it to prompt user to input an number for how many times to toss the coin (Line 6 - 7). Next, we use the input num to control how many times a for loop should run (Line 9). In each round of the loop, call the function <em>toss() </em>and print the output to terminal (Line 10).
Answer:
Explanation:
The "Move Over law" varies by state, but generally requires you vacate the adjacent lane (the one you're currently traveling in), or slow down. Some states have specific speed requirements; others require only "safe and prudent" speed.
The sort of parked vehicles that require you to "move over" also vary by state. It would be "safe and prudent" to move over for <em>any</em> vehicle parked on the shoulder, especially if there are people or animals around those vehicles.
Answer:
hhahhhwghwhwhwhwjwnwjnnnnwnwwnw
Explanation:
jwkwkkwoiwiwiwiwiwowwiwowowiiiiwuuwuwgeevehehsvhsvwhbhhehehwgjjwhwhjwjqwjjuuuwi####!\\\\e
The Pareto principle is that most things in our life are not commonly distributed.
<u>Explanation:</u>
Pareto chart shows that most of the things which we have in our life and the resources in our life are not equally distributed. The ratio is not always 50:50 according to this principle.
The most important use of a Pareto diagram is to show the most important factor among the set of factors that have been shown. Along with that it also shows the sources which lead to the common defects in the system and tries to solve those defects which occur most often.