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

  Identifies the cost of computer

identifies the cost of computer components to configure a computer system (including all peripheral devices where needed) for use in one of the following four situations:

  Input devices

Compare how the gestures data is generated and represented for interpretation in each of the following input devices. In your comparison, consider the data formats (radio waves, electrical signal, sound, etc.), device drivers, operating systems suppo..

  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.

  Prepare an annual budget in an excel spreadsheet

Prepare working solutions in Excel that will manage the annual budget

  Write a research paper in relation to a software design

Research paper in relation to a Software Design related topic

  Describe the forest, domain, ou, and trust configuration

Describe the forest, domain, OU, and trust configuration for Bluesky. Include a chart or diagram of the current configuration. Currently Bluesky has a single domain and default OU structure.

  Construct a truth table for the boolean expression

Construct a truth table for the Boolean expressions ABC + A'B'C' ABC + AB'C' + A'B'C' A(BC' + B'C)

  Evaluate the cost of materials

Evaluate the cost of materials

  The marie simulator

Depending on how comfortable you are with using the MARIE simulator after reading

  What is the main advantage of using master pages

What is the main advantage of using master pages. Explain the purpose and advantage of using styles.

  Describe the three fundamental models of distributed systems

Explain the two approaches to packet delivery by the network layer in Distributed Systems. Describe the three fundamental models of Distributed Systems

  Distinguish between caching and buffering

Distinguish between caching and buffering The failure model defines the ways in which failure may occur in order to provide an understanding of the effects of failure. Give one type of failure with a brief description of the failure

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