Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

ITP-120-Lab #4-Coin Flip I Write a program that simulates a coin flip. Ask the user guess whether the flip coin results in heads or tails.

image text in transcribed

ITP-120-Lab #4-Coin Flip I Write a program that simulates a coin flip. Ask the user guess whether the flip coin results in heads or tails. Use the code number of 0 to indicate Heads and 1 indicate Tails. Then, to "flip" the coin, the program will randomly generate an i of 0 or 1, which represents Heads or Tails. The program will report whether the is correct or incorrect. Sample output is shown below. Be sure to use named constants for the 0 and 1 codes. To generate a random number, use code exar provided in class Requirements Planned Output for the Program Sample Output - Correct Guess Take a guess: enter for Heads or 1 for Tails: You chose Heads. Computer chose Heads. Congratulations! You guessed correctly. Sample Output - Incorrect Guess: Take a guess: enter for Heads or 1 for Tails: 1 You chose Tails. Computer chose Heads You lost. Nice try

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

Modern Database Management

Authors: Fred R. McFadden, Jeffrey Slater, Mary B. Prescott

5th Edition

0805360549, 978-0805360547

More Books

Students also viewed these Databases questions

Question

2. What are your challenges in the creative process?

Answered: 1 week ago