Style is require but comments are not

Assignment Help Basic Computer Science
Reference no: EM13163230

 

Provide the code for a class called Coin.java that implements the main method provided below.

public static void main(String [] args)

{

Coin toss = new Coin();

for (int x = 0; x < 1000; x++)

toss.flip();

Coin.results();

}//end main

When the program runs, the following random output should be produced: (numbers will vary as are random)

Heads: 494

Tails: 506

Program specific requirements:

 

  •  Style is require but comments are NOT required. 
  •  Include appropriate import statements for your file. 
  •  Utilize a constant class array to hold "Heads" and "Tails"
  •  Declare a class ArrayList called flips that will hold integer values, 0 for heads and 1 for tails 
  •  Create a flips method that performs the following: 
  •  Initializes an instance of the Random class and a random variable
  •  Stores a random variable either 0 or 1
  •  Store the random number in the flips ArrayList
  •  Create a results method that performs the following:
  •  Declare variable to hold number of heads flipped
  •  Utilize a for loop to iterate through the ArrayList (do NOT hard code the size here)
  •  For each iteration, increment the result from the ArrayList into a variable called heads
  •  Output the number of Heads using the constant array for the "Heads" heading along with the number of heads flipped
  •  Output the number of Tails using the constant array for the "Tails" heading along with the number of

 

 

 

 

 

Reference no: EM13163230

Questions Cloud

What is the vapor pressure of water : The vapor pressure of water at 20oC is 17.5 mmHg. What is the vapor pressure of water (in mmHg) over a solution prepared from 258 g sucrose (C12H22O11) and 350 g water?
Write a program to convert between rectangular : Write a program to convert between rectangular and cylindrical coordinates, based upon user input. For example, if the user wants to convert cylindrical to rectangular coordinates, the user would input r, ?, z values and the program would output x, y..
Leadership of emperor constantine : Under the leadership of Emperor Constantine.   across the Mediterranean Sea to  Rome
Use a circular linked list to implement the queue : use a circular linked list to implement the queue data structure as described in java
Style is require but comments are not : Style is require but comments are NOT required.  ? Include appropriate import statements for your file.
Court of versailles : Which of the following was the purpose of the court of Versailles?
Write a program that prompts the user to enter an integer : Using && and || write a program that prompts the user to enter an integer and determine whether it is: Evenly divisible by 5 AND 6.
Convert to base hex, octal, decimal and binary : Convert to base hex, octal, decimal and binary the Mayan number (base 20) J7GE.I8H (all done in arithmetic in decimal)
Intrinsic motivation involves active engagement : Intrinsic motivation involves active engagement out of personal interest, while external motivation involves.    According to Maslow's hierarchical model of needs, the most urgent need.

Reviews

Write a Review

Basic Computer Science Questions & Answers

  Program that reads a series of whitespace

Write a program that reads a series of whitespace delimited strings from stdin and prints them back out, separated by spaces, in lexicographic order. You may assume that all strings are lower case and that no string has more than 20 characters.

  Express problem as ilp constraints

Each will receive exactly 7. Additionally, each individual must receive the same quantity of wine. Express the problem as ILP constraints, and find a solution.

  Create a priority queue class called priqueue

Create a priority queue class called priQueue derived from the vector class. construct as a template class. priority queue needs to be based on a value from 1 to 10, any element outside the range of 1 to 10 should be given a value of 5.......

  Assigning value to last array of array list

Write a statement that assigns the value 160000 to the last element of the ArrayList salaryStep.

  Cyclic codes using generator to compute frame check sequence

This question associates to cyclic codes using generator G(X) = X4 + X2 + 1. For following two messages compute Frame Check Sequence. M1 = 00000001, and M2 = 100000. Skecth shift register circuit.

  Sodium sulfate is slowly added to a solution

Sodium sulfate is slowly added to a solution containing 0.0500 M Ca2 (aq) and 0.0390 M Ag (aq). What will be the concentration of Ca2 (aq) when Ag2SO4(s) begins to precipitate?

  Instruction cycle and finding contents of registers

Go over instruction cycle and find out contents of registers PC, AR, DR, AC, and IR for each of seven memory-reference instructions.

  Cores on computer systems

Assignment : Cores on Computer Systems:  Differentiate between multiprocessor systems and many-core systems in terms of power efficiency, cost benefit analysis, instructions processing efficiency, and packaging form factors.

  Evaluating a new hands-free input device

You have been tasked with evaluating a new hands-free input device, the "chair mouse", which the user manipulates by shifting his/her weight in a specially instrumented chair.

  Which library procedures issue system calls

With respect to a programmer, a system call looks the same as a call to a library procedure. Is a programmer required to identify which library procedures issue system calls? Explain your answer.

  Formulate problem as linear programming problem

Formulate the following problem as a linear programming problem and then solve the problem by Excel only. Only the Excel file which shows the problem has been solved by Solver.

  Create directories in home directory begin-mac-mac directory

Create following directories in your home directory cp_even, cp_mid,cp_iso,cp,thousand,cp_even. Examine files in the /usr/share/tcl8.3/encoding directory copy all files which begin with mac into mac directory.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd