Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Purpose: Use data types/variables, various selection structures, random number generation, input/output, performing calculations and formatting output. Description: You have just been given the opportunity to

Purpose: Use data types/variables, various selection structures, random number generation, input/output, performing calculations and formatting output.

Description: You have just been given the opportunity to win prizes from a sweepstakes entry you made at the county fair! The opportunity includes winning 4 prizes, each will be determined by a different game of chance. You may create your own descriptions for the prizes and values as you like, just make sure they are patterned as follows. Each of these requires a random number generation.

1. Flip a coin: Depending upon the heads or tails result, you will get prize1:

1. Heads: A smartphone charger worth $9.99

2. Tails: A 9-volt battery and a wire worth $0.49 (the booby prize)

2. Roll a six-sided die: Depending upon the number that comes up, you will get prize2:

1. 1: A refrigerator magnet worth $1.49

2. 2: A handy grocery bag worth $.59 (the booby prize)

3. 3: A half-price ticket to next years fair worth $4.00

4. 4: A CD with hits from 12 bands playing at the fair worth $12.00

5. 5: A coupon for a free item at one of the concession stands worth $5.00

6. 6: A stuffed animal penguin worth $8.00

3. Spin a roulette wheel: Depending on the color (red or black) and the number (1 to 100), you will get prize3:

1. Red doubles the prize, Black triples the prize

2. Spin 1-20: Earn a penny (the booby prize)

3. Spin 21-40: Earn $4.00

4. Spin 41-60: Earn $1.00

5. Spin 61-80: Earn $2.00

6. Spin 81-100: Earn $3.00

4. Draw one card from a deck of 52: Depending on the number, suit, or face card, you will get prize4:

1. Suits (multiplier): Club (x1), Diamond (x2), Heart (x3), Spade (x4)

2. Numbers 2-10: Get a deck of cards worth $1.00

3. Number 11 (Jack): Get a game of jacks worth $.50 (the booby prize)

4. Number 12 (Queen): Get an autographed picture of the fair queen worth $2.00

5. Number 13 (King): Get an autographed picture of the fair king worth $2.00

6. Number 14: (Ace): Get $10.00

After counting the number of booby prizes one person may get, use the following scale to award a consolation prize:

a. 1 booby prize: $1.00

b. 2 booby prizes: $2.00

c. 3 booby prizes: $3.00

d. 4 booby prizes: $4.00

As you generate the random numbers (use any method you like), here are suggested variables:

Store the following double values as prize1Value, prize2Value, prize3Value, prize4Value;

Store the following string values as prize1Desc, prize2Desc, prize3Desc, prize4Desc;

Store the following string values as result1Desc, result2Desc, result3Desc, result4Desc;

You should shorten the descriptions when storing them, keeping them to 20 chars or less.

Store the count of booby prizes;

Accumulate the total dollar value of all prizes;

Utilize as many other variables as you like

You can experiment with validation loops (optional).

Generate a report the information with a header and 4 detail lines formatted as such:

Example Output:

Game Result Value Booby Prize Description

1 flipped tails $ 0.49 yes 9-volt battery and wire

2 rolled 4 $12.00 no CD of hits

3 came up black 48 $ 3.00 no Money

4 drew Queen/Hearts $ 6.00 no Picture of Queen

Total Value: $21.49

Total Booby Prizes: 1

You also earned $1.00 for on the booby prize contest!

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_2

Step: 3

blur-text-image_3

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

Database Programming With Visual Basic .NET

Authors: Carsten Thomsen

2nd Edition

1590590325, 978-1590590324

More Books

Students also viewed these Databases questions

Question

What are the determinants of cash cycle ? Explain

Answered: 1 week ago

Question

7. What decisions would you make as the city manager?

Answered: 1 week ago