r/code • • Jan 19 '24

Java Help- Confused and using Java

Hi hello So I need help with this the assignment. It asks for you to make code and have it flip a coin a set number of times and then print out the longest streak it had for heads

*Edit* here is my code

my code

I made the code and it worked for 3 of the "test code" but the forth one is different it prints it a bunch of times and gets a streak of 11

the test

but when it runs my code it only comes up with 6 Can someone help me

My test
4 Upvotes

2 comments sorted by

View all comments

Show parent comment

1

u/Heuy_Freeman05 Jan 19 '24

Thanks that makes since i just thought if the loop was set a number of times it would count all that displayed