# Coin Toss

Page 1 of 1

## 3 Replies - 3494 Views - Last Post: 02 November 2008 - 07:59 PMRate Topic: //<![CDATA[ rating = new ipb.rating( 'topic_rate_', { url: 'http://www.dreamincode.net/forums/index.php?app=forums&module=ajax&section=topics&do=rateTopic&t=70058&amp;s=fb3dc5261ca73866f0c1d80e96ea2636&md5check=' + ipb.vars['secure_hash'], cur_rating: 0, rated: 0, allow_rate: 0, multi_rate: 1, show_rate_text: true } ); //]]>

### #1 maneibr

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

# Coin Toss

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

• Professor Snuggly Pants

Reputation: 6544
• Posts: 30,651
• 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.

Thank you for helping us helping you.

### #3 mostyfriedman

• The Algorithmi

Reputation: 729
• 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

### #4 pbl

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

Reputation: 8378
• Posts: 31,956
• Joined: 06-March 08

## Re: Coin Toss

Posted 02 November 2008 - 07:59 PM

mostyfriedman, 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"