Carey Brown wrote:[code=java]I thought all games consisted of 10 free throws.
What is an "attempt"? Again, user entered?
with 10 attempts in each game
If you want to prompt the user for repeated in put, you would want a loop rather than an if. That method belongs in a utility class sepaarate from the other code. Don't create a new Scanner reading from System.in. Create one Scanner per application and use it repeatedly.
make sure the number is between 0 and 100
Yes, exactly. I would have also added loop "Attempt" 10 times.
Sean Mcintosh wrote:Classes were not covered in my course. While I am aware of using different classes I would think that would need to be avoided
So I guess here are my bullet points
Gather User Entered number for a percentage.
User Entered number must be tested for validity (Value between 0 and 100)
If the number is invalid, return invalid. If the number is vaild, store value
Using the stored value from the user. Compare value to a randomly generated number.
If the randomly generated number is higher than user entered value, the attempt is considered failed ("out")
If the randomly generated number is lower or equal to the user entered value, the attempt is considered success ("in)
These will be considered an "attempt" Loop "attempt" 10 times, this will constitute a "game"
Loop "Game" 5 times
After 5 "games" a summary will print
This summary will have
Best game (Which game had most "in")
Worst game (Which game had most "out")
The actual percentage of "in" compared to total number of attempts made
Does this sound like I'm getting somewhere?
Carey Brown wrote:
That is very unfortunate; Java® is supposed to be an object‑oriented language and that makes me suspect you maybe haven't been taught object‑oriented programming.
Sean Mcintosh wrote:Classes were not covered in my course. . . . .
All of the world's problems can be solved in a garden - Geoff Lawton. Tiny ad:
RavenDB is an Open Source NoSQL Database that’s fully transactional (ACID) across your databasehttps://coderanch.com/t/704633/RavenDB-Open-Source-NoSQL-Database