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

  Dynamic programming

Please provide with a detailed answer using DYNAMIC PROGRAMMING

  Kinds of support and tools are available with visual basic

What kinds of support and tools are available with Visual Basic? Sum-up your research, and make sure to reply to each of the questions.

  Dynamic programming

Please provide with a detailed answer using DYNAMIC PROGRAMMING

  Which service to select to achieve operational excellence

Consider not only costs but also such issues as delivery speed, pickup schedules, drop-off locations, tracking ability, and ease of use of the website. Which service did you select? Explain why.

  Computing downtime in telephone per year

Telephone system has an availability of 99.999 percent. How much downtime is that per year? Express your answer in a way that is easy for someone to understand.

  Design hardware-software driver processor-peripheral device

Design the hardware and software driver that will implement a byte-wide data transfer from your processor to a peripheral device.

  Draw a 16 input sorter

Let "10 10 11 10 00 11 10 00" be your input. Draw a 16 input sorter that uses the divide-and-conquer idea of MergeSort. Show the values on each wire at intermediate steps (i.e. output after a half cleaner of 16 inputs).

  Analyze the consequences of experiment done on mice

Group that had been fed had retained this ability, but other group had not. Probable reason that scientists used only mice from same pure-bred strain is so that?

  Rsa protocol to encrypt and decrypt messages

In this problem you are enquired to hand-turn RSA protocol to encrypt and decrypt messages by using rather smaller numbers than are used in practice, so that calculations can be done by hand.

  Converting value stored in register to string representation

For this part of lab exercise, determine problem of converting value stored in a register to string representation of that value in decimal form.

  What do you mean by data independence

What do you mean by data independence? Explain your answer, paying attention to how data independence is implemented.

  Explain roles and influences of computers

Topic is "The Global Economy" . You will be writing the term paper replying to the following questions? Explain the roles and influences of computers and communications technology in increase of trans-border economic activity.

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