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:
<h2>Generator </h2>
Explanation:
A generator converts mechanical energy into electrical energy
Answer:
Define Variables and Use List methods to do the following
Explanation:
#<em>Conjoins two lists together</em>
all_names = male_names.union(female_names)
#<em>Finds the names that appear in both lists, just returns those</em>
neutral_names = male_names.intersection(female_names)
#<em>Returns names that are NOT in both lists</em>
specific_names = male_names.symmetric_difference(female_names)
Answer:
Enthalpy of reaction (kJoules/mole)
Heat of formation of products (kJoules/mole)
Heat of reaction of reactants (kJoules/mole)
Explanation:
The general expression for calculating the overall enthalpy of reaction is given as following:
ΔH = ∑ΔH[producst] - ∑Δ[reactants]
Thus, the heat of reaction is given as the difference between the formation of the products and the formation of the reactants. The units are expressed as kJ/mol of reactants or products.
Thus, the three values are fundamental in the determination of the overall energy of the reaction from Hess' Law.