# A machine is being built out of two types of parts A and B Part A

Content type
User Generated
Rating
Showing Page:
1/5
A machine is being built out of two types of parts: A and B.
Part A will work 98% of the time when turned on and part B
works 90% of the time when turned on. The machine has
10 of part A and five of part B. For the machine to operate
correctly when turned on, all 10 of part A must function
and at least 3 of part B must function.
(A) What is the probability that the machine will operate
correctly when turned on
(B) Verify that the number of simulations you are running is
sufficient by graphically showing convergence in the
probability of successful operation. Display in a plot with
the horizontal in log-scale and the vertical in linear-scale.
If you find it was not, redo part (A)
Hint: to simulate turning the machine on, you will want to
have random numbers that determine the success or
failure of each part. Then you will want to test if enough
parts work for the machine to function. Repeat this
simulation until convergence.
Solution
import java.util.Scanner;
import java.util.Random;
public class DiceProbability
{public static void main(String[] args)
{
Scanner in = new Scanner(System.in);

Showing Page:
2/5
Random generator = new Random();
int ones = 0;
int twos = 0;
int threes = 0;
int fours = 0;
int fives = 0;
int sixes = 0;
int sevens = 0;
int eights = 0;
int nines = 0;
int tens = 0;
int elevens = 0;
int twelves = 0;
System.out.println(\"Please enter a number of dice
rolls\");
int rolls = in.nextInt();
for(int start = 0; start < rolls; start++)
{int random = generator.nextInt(12) + 1;
for(int side1= 0; start < rolls;)
{if(random == 1)
{ones++;}
else if(random == 2)
{twos++;}
else if(random == 3)

Showing Page:
3/5

End of Preview - Want to read all 5 pages?
Access Now
Unformatted Attachment Preview
A machine is being built out of two types of parts: A and B. Part A will work 98% of the time when turned on and part B works 90% of the time when turned on. The machine has 10 of part A and five of part B. For the machine to operate correctly when turned on, all 10 of part A must function and at least 3 of part B must function. (A) What is the probability that the machine will operate correctly when turned on (B) Verify that the number of simulations you are running is sufficient by graphically showing convergence in the probability of successful operation. Display in a plot with the horizontal in log-scale and the vertical in linear -scale. If you find it was not, redo part (A) Hint: to simulate turning the machine on, you will want to have random numbers that determine the success or failure of each part. Then you will want to test if enough parts work for the machine to function. Repeat this simulation until convergence. Solution import java.util.Scanner; import java.util.Random; public class DiceProbability {public static void main(String[] args) { Scanner in = new Scanner(System.in); Random generator = new Random(); int ones = 0; int twos = 0; int threes = 0; int fours = 0; int fives = 0; int sixes = 0; int sevens = 0; int eights = 0; int nines = 0; int tens = 0; int elevens = 0; int twelves = 0; System.out.println(\"Please enter a number of dice rolls\"); int rolls = in.nextInt(); for(int start = 0; start < rolls; start++) {int random = generator.nextInt(12) + 1; ...
Purchase document to see full attachment
User generated content is uploaded by users for the purposes of learning and should be used following Studypool's honor code & terms of service.

### Review

Anonymous
Great! Studypool always delivers quality work.

Studypool
4.7
Trustpilot
4.5
Sitejabber
4.4