Coin Toss

help to write code

Page 1 of 1

3 Replies - 3027 Views - Last Post: 02 November 2008 - 07:59 PM Rate Topic: -----

#1 maneibr  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 01-November 08

Coin Toss

Post icon  Posted 01 November 2008 - 11:08 PM

Consider a class Coin that represents a coin. The class has methods such as getValue, toss, and isHeads. The method getValue returns the value, or denomination, of a coin. The method toss simulates a coin toss in which the coin lands either heads up or tails up. The method isHeads returns true if a coin is heads up.
Suppose that coinList is an ADT list of coins that have randomly selected denominations. Toss each of these coins. If the result of a coin toss is heads, move the coin to a second list called headsList; if it is tails, leave the coin in the original list.
When you are finished tossing coins, compute the total value of the coins that came up heads. Assume that the list headsList has been created for you and is empty initially.

Is This A Good Question/Topic? 0
  • +

Replies To: Coin Toss

#2 no2pencil  Icon User is online

  • Admiral Fancy Pants
  • member icon

Reputation: 5389
  • View blog
  • Posts: 27,386
  • Joined: 10-May 07

Re: Coin Toss

Posted 01 November 2008 - 11:11 PM

Dream.In.Code has a policy by which we prefer to see a good faith effort on your part before providing source code for homework assignments. Please post the code you have written in an effort to resolve the problem, and our members would be happy to provide some guidance. Be sure to include a description of any errors you are encountering as well.

Please post like this:

Thank you for helping us helping you.
Was This Post Helpful? 0
  • +
  • -

#3 mostyfriedman  Icon User is offline

  • The Algorithmi
  • member icon

Reputation: 727
  • View blog
  • Posts: 4,473
  • Joined: 24-October 08

Re: Coin Toss

Posted 02 November 2008 - 06:18 AM

this problem is a simple one, i'm sure you can do it...try to solve some parts and post your code and if u still have problems with it, i will give you some pointers
Was This Post Helpful? 0
  • +
  • -

#4 pbl  Icon User is offline

  • There is nothing you can't do with a JTable
  • member icon

Reputation: 8346
  • View blog
  • Posts: 31,908
  • Joined: 06-March 08

Re: Coin Toss

Posted 02 November 2008 - 07:59 PM

View Postmostyfriedman, on 2 Nov, 2008 - 06:18 AM, said:

this problem is a simple one, i'm sure you can do it...try to solve some parts and post your code and if u still have problems with it, i will give you some pointers

Yes wouldn't have qualified it as "Intermediate"
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1