Question
Hi! I'm having trouble trying to figure out how to do one of my problems for my programming class. If anyone knows anything about programming
Hi! I'm having trouble trying to figure out how to do one of my problems for my programming class. If anyone knows anything about programming and or loops, your help would be very appreciated!
A standard dartboard has the values 1-20. It's also possible to miss the board and get zero points. For this project, we're going to ignore bull's eyes and multipliers, so the only possible dart values are 0-20, and we'll assume they're all equally likely. In a game of 301, you start with 301 points, and the goal is to reach 0 points. Each time you throw a dart, if the dart value is less than or equal to your remaining score, you subtract the dart value from your total. If subtracting the dart value from your score would take you below zero, the dart doesn't count. (For those familiar with darts, we're going to assume one throw turns just for simplicity.) For each dart throw, tell the user the throw number, whether the dart missed, the value of the dart if it didn't miss, whether the dart counted, and the updated score if the dart did count.
This program requires no user interaction, and since we're using a random number generator, each run should be different. Some sample runs are below, but it is unlikely that your program will generate the exact same sequence. However, note how the program responds to each throw.
Suggested order of development:
At first, have the program generate a random number and print it out
Then have the program loop 10 times and generate different random numbers for each loop iteration
Then have the program start with a score of 301, generate a random number each iteration and subtract that from the running total
Once you're at that point, then you can add in the rest of the requirements above.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started