Questions
Task #1 The while Loop (8 pts) 1. Copy the file DiceSimulation.java as directed by your...

Task #1 The while Loop (8 pts) 1. Copy the file DiceSimulation.java as directed by your instructor. Correct syntax errors if any, and improve programming style when necessary (indents, newlines, etc.). DiceSimulation.java is incomplete. Since there is a large part of the program missing, the output will be incorrect if you run DiceSimulation.java. 2. We have declared all the variables. You need to add code to simulate rolling the dice and keeping track of the doubles. Convert the algorithm below into Java code and place it in the main method after the variable declarations, but before the output statements. You will be using several control structures: a while loop and an if-else-if statement nested inside another if statement. Use the indenting of the algorithm to help you decide what is included in the loop, what is included in the if statement, and what isincluded in the nested if-else-if statement. 3. To “roll” the dice, use the nextInt method of the random number generator to generate an integer from 1 to 6. Repeat while the number of dice rolls are less than the number of times the dice should be rolled. Get the value of the first die by “rolling” the first die Get the value of the second die by “rolling” the second die If the value of the first die is the same as the value of the second die If value of first die is 1 Increment the number of times snake eyes were rolled Else if value of the first die is 2 Increment the number of times twos were rolled Else if value of the first die is 3 Increment the number of times threes were rolled Else if value of the first die is 4 Increment the number of times fours were rolled Else if value of the first die is 5 Increment the number of times fives were rolled Else if value of the first die is 6 Increment the number of times sixes were rolled Page 3 of 3 Increment the number of times the dice were rolled 4. Compile and run. You should get numbers that are somewhat close to 278 for each of the different pairs of doubles. Run it several times. You should get different results than the first time, but again it should be somewhat close to 278. Task #2 Using Other Types of Loops: do-while (4 pts) 1. Change the while loop to a do-while loop. 2. Make other necessary changes to save your work as new file named DiceSimulation_Do.java. 3. Compile and run. You should get the same results as at Task #1. Task #3 Using Other Types of Loops: for (4 pts) 1. Change the do-while loop to a for loop. 2. Make other necessary changes to save your work as new file named DiceSimulation_For.java. 3. Compile and run. You should get the same results as at Task #1.

import java.util.Random;   // Needed for the Random class

/**
   This class simulates rolling a pair of dice 10,000 times
   and counts the number of times doubles of are rolled for
   each different pair of doubles.
*/

public class DiceSimulation
{
   public static void main(String[] args)
   {
      final int NUMBER = 10000;  // Number of dice rolls

      // A random number generator used in
      // simulating the rolling of dice
      Random generator = new Random();

      int die1Value;       // Value of the first die
      int die2Value;       // Value of the second die
      int count = 0;       // Total number of dice rolls
      int snakeEyes = 0;   // Number of snake eyes rolls
      int twos = 0;        // Number of double two rolls
      int threes = 0;      // Number of double three rolls
      int fours = 0;       // Number of double four rolls
      int fives = 0;       // Number of double five rolls
      int sixes = 0;       // Number of double six rolls

      // TASK #1 Enter your code for the algorithm here

      // Display the results
      System.out.println ("You rolled snake eyes " +
                          snakeEyes + " out of " +
                          count + " rolls.");
      System.out.println ("You rolled double twos " +
                          twos + " out of " + count +
                          " rolls.");
      System.out.println ("You rolled double threes " +
                          threes + " out of " + count +
                          " rolls.");
      System.out.println ("You rolled double fours " +
                          fours + " out of " + count +
                          " rolls.");
      System.out.println ("You rolled double fives " +
                          fives + " out of " + count +
                          " rolls.");
      System.out.println ("You rolled double sixes " +
                          sixes + " out of " + count +
                          " rolls.");
   }
}

In: Computer Science

write a java program that allows the user to insert two number consists of only 3...

write a java program that allows the user to insert two number consists of only 3 digits and print it and all a number between it but don't print any number that has digits equal to a number 4. like (211,212,213,215,...,350), if the user print number that not equal to 3 digits like ( 23,2298,1) print invalid number

In: Computer Science

in your own words explain What changes are occurring in the arts and literature from the...

in your own words explain

What changes are occurring in the arts and literature from the late Medieval period to the early Renaissance?

In: Psychology

What are some risks of a Queens corporation managing global supply chain? Provide example of political...

What are some risks of a Queens corporation managing global supply chain? Provide example of political Risk and Currency Risk?

In: Operations Management

What are the consequences of avoiding all conflict? What role do perceptions play in creating conflict?...

What are the consequences of avoiding all conflict? What role do perceptions play in creating conflict? Are most conflicts about facts or about underlying feelings? Is compromise the same as collaboration? How can a supervisor best remain nonjudgmental, supportive, problem-oriented, and sensitive to everyone's needs in the face of conflict?

In: Operations Management

In 1-2 pages (a paragraph or so for each item), describe your top 3 security-related takeaways...

In 1-2 pages (a paragraph or so for each item), describe your top 3 security-related takeaways or security insights you noted while reading the book.(cuckoos egg.)

  • These insights can be about anything you noted in the story (chocolate chip recipes do not count, though) whether it is about technology, investigative/(pre)forensic techniques—technical or otherwise, preventative, reactive, collaboration (or lack thereof) between entities/organizations/groups, etc

In: Computer Science

Describe the ecological, economic, and social challenges that can arise when considering a species reintroduction. Note...

  • Describe the ecological, economic, and social challenges that can arise when considering a species reintroduction. Note that “social” in this context refers to human societies. The term “ecological” should be used to refer to intra-species or inter-species interactions that don’t include humans.

In: Biology

The impact of service or customer care service quality management on the pharmaceutical organization performance..This is...

The impact of service or customer care service quality management on the pharmaceutical organization performance..This is the topic to write an introduction on.Also note that your work should be referenced from only year 2015-2020.Any other reference work apart from year mentioned earlier won't be accepted,Reference sources should kindly be noted down.Thank you.Already rated

Question updated now.Write an introduction for the said topic

In: Operations Management

Can you assist me in understand and write the steps in this code? Write a method...

Can you assist me in understand and write the steps in this code?

Write a method named howMany that does not take in any arguments. Use the Scanner class to ask the user to enter a number between 1 and 5. Print One of the following based on their entry.

1    2 3 4 5   Anything Other Number   

“Lonely Num” “Company” "Crowd" "Fun" "Party"     "Only 1 to 5 Please"

In: Computer Science

A chocolate chip cookie manufacturing company recorded the number of chocolate chips in a sample of...

A chocolate chip cookie manufacturing company recorded the number of chocolate chips in a sample of 70 cookies. The mean is 22.24 and the standard deviation is 2.44. .Construct a 98​% confidence interval estimate of the standard deviation of the numbers of chocolate chips in all such cookies. How do I find the degree of freedom, which is 69, using the chi critical value table? 69 is not listed on there, just 60 and 70. Not sure how to use my TI-84 calculator to figure it out.

In: Math

1) Imagine you are the owner of an e-commerce Web site. a. What are some of...

1) Imagine you are the owner of an e-commerce Web site.

a. What are some of the signs that your site has been hacked?

b. Discuss the major types of attacks you could expect and the resulting damage to your site.

2) Given the shift toward mobile commerce,

a. do a search on mobile commerce crime.

b. Identify and discuss in one page the new security threats this type of technology creates.

In: Computer Science

Write a JavaFx program for addition of two numbers. (create text as Number1, Number2 and Result...

Write a JavaFx program for addition of two numbers. (create text as Number1, Number2 and Result and create 3 textfileds. Create sum button. You have to enter number1 and number2 in the textfileds. If you click the button Sum, the result will be showed in the third text field.

In: Computer Science

write a java code to implement a linked list, called CupList, to hold a list of...

write a java code to implement a linked list, called CupList, to hold a list of Cups.

1.Define and write a Cup node class, called CupNode, to hold the following information about a cup:

•number (cup number)

•capacity (cup capacity in ml)

•Write a method size() that returns the number of elements in the linkedlist CupList.

•Write a method getNodeAt() that returns the reference to cup node object at a specific position given as a parameter of the method.

•Write a method, insertPos(),  to insert a new CupNode object at a specific position given as a parameter of the method.

•Write a method, deletePos(),  to remove the CupNode object at a specific position given as a parameter of the method.

•Write a method, swapNodes,  to swap two nodes at two positions pos1 and pos2 given as parameters of the method.

Implement the Cup list using double linked list.

•Update CupNode class by adding a link to the previous node in the list. Then update the constructor of the class

•Update the CupList by adding a last attribute, to hold the reference to the last node of the list.

•Implement the following methods in CupList isEmpty(), size(), insertAtFront(), insertAtRear(), insertAt(), removeFirst(), removeLast(), removeAt().

  CupNode should have a constructor and methods to manage the above information as well as the link to next node in the list.

2.Define and write the CupList class to hold objects of the class CupNode. This class should define:

a)a constructor,

b)a method isEmpty() to check if the list is empty or not,

c)a method insert() that will allow to insert a new cup node at the end of the list,

d)a method print() that will allow to print the content of the list,

e)A method getCupCapacity() that will return the capacity of a cup given its number. The method should first find out if a cup with that number is in the list.

3.Write a TestCupList class to test the class CupList. This class should have a main method in which you perform the following actions :

a)Create a CupList object,

b)Insert five to six CupNode objects into the created Cup List,

c)Print the content of your cup list,

d)Search for a given cup number in the list and print out its capacity.

In: Computer Science

An article in Computers & Electrical Engineering, “Parallel simulation of cellular neural networks” (1996, Vol. 22,...

An article in Computers & Electrical Engineering, “Parallel simulation of cellular neural networks” (1996, Vol. 22, pp. 61–84) considered the speed-up of cellular neural networks (CNN) for a parallel general-purpose computing architecture based on six transputers in different areas. The data follow: 3.775302 3.350679 4.217981 4.030324 4.639692 4.139665 4.395575 4.824257 4.268119 4.584193 4.930027 4.315973 4.600101 Round your answers to 3 decimal places. Assume population is approximately normally distributed. (b) Construct a 99% two-sided confidence interval on the mean speed-up. Enter your answer; confidence interval, lower bound ≤μ≤ Enter your answer; confidence interval, upper bound (c) Construct a 99% lower confidence bound on the mean speed-up. Enter your answer in accordance to the item c) of the question statement ≤μ

In: Math

Many professors have a policy that punishes individuals if the don’t come to class. Instead of...

Many professors have a policy that punishes individuals if the don’t come to class. Instead of punishing students who do not attend class, what could professors do to provide a positive incentive to come to class?

In: Psychology