Re: Coin Flip (Python Newbie) Programming Software Development by jassonadder …; were tails.") This version should now properly flip a coin 100 times and track how many heads and tails you… Re: Java Coin Flip Program Programming Software Development by jassonadder … how many times the user wants to flip a coin, prints each result, and then shows the totals …("How many times would you like to flip the coin? ")) flipper = CoinFlipper() flipper.flipCoin(flips) except ValueError:…() and handles user input nicely. It will flip a coin as many times as requested, show each result, and… Re: Coin Flip (Python Newbie) Programming Software Development by Dani > Presumably bumping every "coinflip" post to spam their URL Nothing wrong with that!! I'll take a trillion helpful posts if all someone wants in exchange is a free signature link back to their website (that only shows up for logged in members, so no SEO incentive). Re: Coin Flip (Python Newbie) Programming Software Development by woooee while timesflipped < 100: timesflipped += 1 Use a for loop instead. if coin_flips == 0: And no need to add the == 0. Just *if coin_flips* (i.e. not zero) is enough Re: Coin Flip (Python Newbie) Programming Software Development by Reverend Jim When you want to do a loop a given number of times (e.g. 100) but the loop counter is not used you can do for _ in range(100): # rest of code here Re: Java Coin Flip Program Programming Software Development by Dani Better late than never! Thanks for your post. It looks like it's really helped a few people already. Re: Java Coin Flip Program Programming Software Development by Salem > It looks like it's really helped a few people already. Yeah, 4 new members with consecutive user ID's, smelling like sock-puppet accounts. Re: Java Coin Flip Program Programming Software Development by Dani > Yeah, 4 new members with consecutive user ID's, smelling like sock-puppet accounts. I realized that after I posted. I’m on my phone on the sofa so it wasn’t as easy to tell. Although I still can’t see the motivation. Edit: Nevermind. Perhaps they were trying to improve their member reputation/quality score?? (Won’t work because you need… Coin Purse Program Programming Software Development by compscinerd69 Coin(Coin.PENNY)); myPurse.addCoin(new Coin(Coin.NICKEL)); myPurse.addCoin(new Coin(Coin.PENNY)); myPurse.addCoin(new Coin(Coin.PENNY)); myPurse.addCoin(new Coin(Coin.QUARTER)); myPurse.addCoin(new Coin(Coin Re: Coin Purse Program Programming Software Development by compscinerd69 Coin(Coin.PENNY)); myPurse.addCoin(new Coin(Coin.NICKEL)); myPurse.addCoin(new Coin(Coin.PENNY)); myPurse.addCoin(new Coin(Coin.PENNY)); myPurse.addCoin(new Coin(Coin.QUARTER)); myPurse.addCoin(new Coin(Coin Re: Coin Purse Program Programming Software Development by VernonDozier Coin(Coin.PENNY)); myPurse.addCoin(new Coin(Coin.NICKEL)); myPurse.addCoin(new Coin(Coin.PENNY)); myPurse.addCoin(new Coin(Coin.PENNY)); myPurse.addCoin(new Coin(Coin.QUARTER)); myPurse.addCoin(new Coin(Coin Re: Coin Purse Program Programming Software Development by compscinerd69 Coin(Coin.PENNY)); myPurse.addCoin(new Coin(Coin.NICKEL)); myPurse.addCoin(new Coin(Coin.PENNY)); myPurse.addCoin(new Coin(Coin.PENNY)); myPurse.addCoin(new Coin(Coin.QUARTER)); myPurse.addCoin(new Coin(Coin Re: Coin Purse Program Programming Software Development by compscinerd69 Coin(Coin.PENNY)); myPurse.addCoin(new Coin(Coin.NICKEL)); myPurse.addCoin(new Coin(Coin.PENNY)); myPurse.addCoin(new Coin(Coin.PENNY)); myPurse.addCoin(new Coin(Coin.QUARTER)); myPurse.addCoin(new Coin(Coin Re: Coin Purse Program Programming Software Development by VernonDozier … relies on your Coin class, so write a bare-bones Coin class first: [code] public class Coin { String name; public Coin (String coinname) { name… Re: Coin Purse Program Programming Software Development by BestJewSinceJC … class Purse. A purse contains a collection of coins. Each coin object must contain its name. You should not put a… will need 2 Java Object Classes: one to define the Coin objects, and one for the Purse object. [/QUOTE] 1. Decide…, and decide what kind of data each class (Purse and Coin) needs. Well, since a purse holds coins, the Purse class… Coin change with different upper bounds on different coins? Programming Software Development by iamnot …compfn)(const void*, const void*); struct pair { int coin; int numberofcoin; }; int compare(const struct pair …a[j].numberofcoin--; ans+=wa(n-a[j].coin,a,numberofdenominations,a[j].coin); a[j].numberofcoin++; } } } return ans… Re: Coin Flip (Python Newbie) Programming Software Development by Arrorn … a program... [code=python] import random import time print "Coin Toss Program" print "\nProgrammed by Devon McAvoy"…('T\n') time.sleep(.2) counter += 1 print "\nThe coin landed on heads", heads, "times." print "… Re: Coin Problem java Programming Software Development by mehmud …} public String toString(){ return "The coin name is "+name+" and the …class Wallet { int coinNumber=0; Coin c=new Coin(); String a="penny"; String…quot;:" +coinNumber); } public boolean equals(Coin c){ if(this.getName().equals(c.getName())… Re: Coin change with different upper bounds on different coins? Programming Software Development by sepp2k I think you might get more help if you described your recursive algorithm instead of requiring us to discern it from your uncommented code. Anyway I think the standard dynamic programming solution for the coin change problem can be adjusted to work for this variation of the problem. coin toss problem Programming Software Development by rdanda … is homework, but I am trying. The problem is: Simulate coin tossing Program must print Heads or Tails. Toss 100 times… and count the number of times each side of the coin appears. Call a function "flip" that takes no…. What I'm trying to accomplish is flip the coin, if the coin is 0 then inclement the counter for tails, or… Coin Problem java Programming Software Development by mehmud Implement in Java a class Coin that describes a coin with a name (e.g. dime) and a…of coins. Supply a method add() to add a coin to a purse, and a method printContent() that prints…wallet Prompts the user to enter the name of a coin (e.g. dime), or an empty string to…to enter the value of a coin (e.g. 10 cents) Adds the coin to the wallet Prints the … Re: Coin Problem java Programming Software Development by bguild … shouldn't have those setters in `Coin`. Instead you should add an `Coin.equals` and a `Coin.hashCode` so that you can use… your coins as keys in a `java.util.HashMap<Coin,Integer>`. You are creating a new `Wallet` every time… at the beginning. Your `Wallet.add` method should take a coin as an argument, otherwise it won't know what to… Coin Toss Simulation - Real Python Programming Software Development by flebber …least once each – in other words, after I flip the coin the first time, I continue to flip it until I… average, how many times will I have to flip the coin total? " So created the code: from __future__ import division… of 2 which I thought would be right considering a coin is 2 sided. However the solution is different: from … Re: coin toss problem Programming Software Development by Narue …;unsigned> ( std::time ( 0 ) ) ); flip(); } void flip() { // Your coin flipping logic } [/code] Note that srand needs to be called…a single seed goes a long way. As for your coin flipping logic, it looks largely decent. The syntax for your…in a loop. Right now you're only testing one coin toss, so I'd recommend an argument to the … Re: Coin Problem java Programming Software Development by tux4life >Should wallet extend coin? Whenever in doubt apply the **IS A**-test: *Wallet **IS A** Coin?* (or rephrased: ***IS** Wallet **A** Coin?*) If the answer to that question is no, then you shouldn't. Coin Toss Simulation, getting all Tails and one Heads Programming Software Development by Rickenbacker360 … I'm supposed to do: Create a function that simulates coin tossing. The function should have no input and no return… asks the number of times they want to flip the coin, say 20, then the function will call random number function…;"How many times would you like to flip the coin?"<< endl;[/COLOR] [COLOR=black] cin >>… Coin simulate Programming Software Development by Mclovin1234 … { double heads = 0; double tails = 0; int coin; srand (time(0) ); for (int flip = 1;… flip <= 10; flip++) { coin = 1 +rand()%2; switch (coin) { case 1: ++heads; break; case 2:… Coin flip winnings Programming Software Development by Mclovin1234 …{ int heads = 0; int tails = 0; int coin; srand (time(0)); for (int flip = 1; …flip <= 10; flip++) { coin = 1 +rand()%2; switch (coin) { case 1: ++heads; break; case 2:… Coin Distribution Problem Programming Software Development by passcode121 … We are interested in distributing a number of coins (each coin, say, is 1$) among a group of people. For example… gets nothing. · The first person gets one coin and the other also gets one coin. · The first person gets nothing and the… coins among k people. Each person may get from 0 coin to n (all) coins. Write a program that reads a… Re: Coin flip winnings Programming Software Development by Mclovin1234 …,int); int main() { int heads = 0; int tails = 0; int coin; srand (time(0)); for (int flip = 1; flip <= 10…; flip++) { coin = 1 +rand()%2; switch (coin) { case 1: ++heads; break; case 2: ++tails; break…