summaryrefslogtreecommitdiffstats
path: root/Java/coin.java
diff options
context:
space:
mode:
authormsglm <msglm@techchud.xyz>2023-01-14 05:31:48 -0600
committermsglm <msglm@techchud.xyz>2023-01-14 05:31:48 -0600
commit9d53d8857eaa1c9405894a88ca75bc4657e42f35 (patch)
treeeb1efc1d028b949dd83bb710c68be8eff58f26e7 /Java/coin.java
downloadschool-code-master.tar.gz
school-code-master.tar.bz2
school-code-master.zip
Inital CommitHEADmaster
Diffstat (limited to 'Java/coin.java')
-rw-r--r--Java/coin.java28
1 files changed, 28 insertions, 0 deletions
diff --git a/Java/coin.java b/Java/coin.java
new file mode 100644
index 0000000..4765812
--- /dev/null
+++ b/Java/coin.java
@@ -0,0 +1,28 @@
+import java.util.Random;
+
+public class coin{
+
+ private boolean status;
+
+public coin(){
+ Random random = new Random();
+if (random.nextInt() % 2 == 1){
+ status = true;
+} else {
+ status = false;
+}
+
+}
+
+public String toString(){
+ if(status){
+return "coin is heads";
+ } else {
+return "coin is tails";
+ }
+}
+
+}
+
+
+