id/email
password
forgot password | create account
about | help | code help+videos | done | prefs
CodingBat code practice

 

spinCoin


You want to flip a coin, but you don't have a coin. But you do have a spinner that has 10 spaces numbered 1, 2, 3, 4, 5, 6, 7, 8, 9, 10. Write a method that returns "heads" if the number spun is 1 through 5, and tails if the number spun is 6 through 10.


spinCoin(1) → "heads"
spinCoin(6) → "tails"
spinCoin(2) → "heads"

...Save, Compile, Run (ctrl-enter)

String spinCoin(int val) { }

Editor font size %:
Shorter output


Forget It! -- delete my code for this problem

Progress graphs:
 Your progress graph for this problem
 Random user progress graph for this problem
 Random Epic Progress Graph

Java Help

Misc Code Practice

Difficulty: 100

Copyright Nick Parlante 2017 - privacy