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
Deffense [45]
3 years ago
9

In javaWrite a program that simulates flipping a coin to make decisions. The input is how many decisions are needed, and the out

put is either heads or tails. Assume the input is a value greater than 0.Ex: If the input is 3, the output is:tails heads headsFor reproducibility needed for auto-grading, seed the program with a value of 2. In a real program, you would seed with the current time. In that case, every program's output would be different, which is what is desired but can't be auto-graded.Note: A common student mistake is to create an instance of Random before each call to rand.nextInt(). But seeding should only be done once, at the start of the program, after which rand.nextInt() can be called any number of times.Your program must define and call the following method that returns "heads" or "tails".public static String HeadsOrTails(Random rand)
Engineering
1 answer:
Pavel [41]3 years ago
7 0

Answer:

// Program is written in Java Programming Language

// Comments are used for explanatory purpose

import java.util.*;

public class FlipCoin

{

public static void main(String[] args)

{

// Declare Scanner

Scanner input = new Scanner (System.in);

int flips;

// Prompt to enter number of toss or flips

System.out.print("Number of Flips: ");

flips = input.nextInt();

if (flips > 0)

{

HeadsOrTails();

}

}

}

public static String HeadsOrTails(Random rand)

{

// Simulate the coin tosses.

for (int count = 0; count < flips; count++)

{

rand = new Random();

if (rand.nextInt(2) == 0) {

System.out.println("Tails"); }

else {

System.out.println("Heads"); }

rand = 0;

}

}

You might be interested in
Source water pollution in Madagascar
vodka [1.7K]

Answer:

What is the question?

Explanation:

7 0
3 years ago
How is TEL (total equivalent length) measured and calculated? .​
ollegr [7]
Measure the longest circuit and add 50% for fittings and terminal units.
3 0
3 years ago
Drag the tiles to the boxes to form correct pairs. Identify the designations of the three employees in an automobile company fro
aniked [119]

Answer:

is the fare of our responsibility towards

7 0
3 years ago
Consider a N-channel enhancement MOSFET with VGS = 3V, Vt = 1 V, VDS = 10 V, and lambda =0 (channel length modulation parameter)
AveGali [126]

The current IDS is greater than 0 since the VGS has induced an inversion layer and the transistor is operating in the saturation region.

<u>Explanation:</u>

  • Since V_{ds} > V_{gs} - Vt because V_{gs} > Vt.
  • By the saturation region the MOSFET is operating.
  • A specific source voltage and gate of NMOS, the voltage get drained during the specific level, the drain voltage is rises beyond where there is no effect of current during saturated region.
  • MOSFET is a transistor which is a device of semiconductor vastly used for the electronic amplifying signals and switching in the devices of electronics.
  • The core of this is integrated circuit.
  • It is fabricated and designed in an individual chips due to tiny sizes.
7 0
3 years ago
Find the number of Btu conducted through a wall in 8 hours. The wall is 8 feet high by 24 feet long and has a total R-value of 1
dedylja [7]

Answer:

ΔQ = 4930.37 BTu

Explanation:

given data

height h = 8ft

Δt = 8  hours

length L = 24 feet

R value = 16.2 hr⋅°F⋅ft² /Btu

inside temperature t1 = 68°F

outside temperature t2 = 16°F

to find out

number of Btu conducted

solution

we get here number of Btu conducted by this expression that s

\frac{\Delta Q}{\Delta t} =\frac{-A}{R} (t2 -t1)     ......................1

here A is area that is = h × L = 8 × 24 = 1492 ft²

put here value we get

\frac{\Delta Q}{8} =\frac{-192}{16.2} (16-68)

solve it we get

ΔQ = 4930.37 BTu

7 0
3 years ago
Other questions:
  • What is centrifugal force with respect to unbalance? What is the formula used to determine centrifugal force?
    12·1 answer
  • A 200 W vacuum cleaner is powered by an electric motor whose efficiency is 70%. (Note that the electric motor delivers 200 W of
    13·1 answer
  • Saturated liquid water at 150 F is put under pressure to decrease the volume by 1% while keeping the temperature constant. To wh
    8·1 answer
  • If a and b are both int arrays, then a b; will
    10·1 answer
  • How to walk a dog dududududududududesssss
    6·2 answers
  • What is this i dont understand this at all
    9·1 answer
  • Resistance depends on which three properties of a wire?
    15·1 answer
  • Can somebody help me with that
    13·1 answer
  • For many people in 3D modeling copyrights and licensing allow them to earn a living.
    12·1 answer
  • 40 POINTS IF ANSERED WITHIN 10 MINS
    13·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!