Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Concepts of Database Management

Authors: Philip J. Pratt, Mary Z. Last

8th edition

1285427106, 978-1285427102

More Books

Students also viewed these Databases questions

Question

How should a firm go about constructing a product attribute map?

Answered: 1 week ago

Question

In an Excel Pivot Table, how is a Fact/Measure Column repeated?

Answered: 1 week ago