Skip to content

Instantly share code, notes, and snippets.

@Gzoref
Last active August 7, 2018 00:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Gzoref/90268d3ee98fbeb7d3cb7c4e8c556b25 to your computer and use it in GitHub Desktop.
Save Gzoref/90268d3ee98fbeb7d3cb7c4e8c556b25 to your computer and use it in GitHub Desktop.
import java.util.*;
/*
* Name:
* Date: 4/21/2018
* Project: CoinToss
*/
public class Coin {
String sideUp;
public Coin() {
toss();
}
public void toss() {
Random randomNum = new Random();
int randomNumber;
randomNumber = randomNum.nextInt(2);
if (randomNumber == 0) {
sideUp = "tails";
} else {
sideUp = "heads";
}
}
public String getSideUp() {
return sideUp;
}
}
/**
Create an Array field for Coin Toss, this will show if the toss was Heads or tails.
Create an Array field to show what the value was for that toss, .25, or .10 or .5
Create an Array field to keep track of was that an add or a minus value.
Note:
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment