Python Programming: An Introduction to Computer Science
Python Programming: An Introduction to Computer Science
3rd Edition
ISBN: 9781590282779
Author: John Zelle
Publisher: Franklin Beedle & Associates
bartleby

Videos

Question
Book Icon
Chapter 9, Problem 7PE
Program Plan Intro

Simulates craps game

Program Plan:

  • Import the header file.
  • Define the “main” method.
    • Call the “printIntro ()” method
    • Get the input from the user.
    • Call the “simNCraps ()” method and store it in a variable.
    • Call the “printSummary ()” method.
  • Define the “printIntro()” method.
    • Print the intro statements.
  • Define the “simNCraps()” method.
    • Set the values
    • Iterate “i” until it reaches “n” value
      • Check the condition
        • Increment the “winsA” value
      • Otherwise, increment the “losses” value.
      • Return the value.
  • Define the “simOneCraps ()” method
    • Call the “randrange ()” method
    • Check the “x” is equal to 2 or 3 or 12
      • Return false
          • Check the “x” is equal to 7 or 11
            • Return true
          • Otherwise,
            • Set the value
            • If “x” is not equal to “y” and 7
              • Call the “randrange ()” method
              • Check “y” is equal to 7
                • Return false
              • Check “y” is equal to “x”
                • Return true
  • Define the “printSummary ()” method
    • Display the results.
  • Call the main method.

Blurred answer
Students have asked these similar questions
Of the five primary components of an information system (hardware, software, data, people, process), which do you think is the most important to the success of a business organization? Part A - Define each primary component of the information system. Part B - Include your perspective on why your selection is most important. Part C - Provide an example from your personal experience to support your answer.
Management Information Systems
Q2/find the transfer function C/R for the system shown in the figure Re ད
Knowledge Booster
Background pattern image
Computer Science
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
SEE MORE QUESTIONS
Recommended textbooks for you
Text book image
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781337671385
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT
Text book image
Operations Research : Applications and Algorithms
Computer Science
ISBN:9780534380588
Author:Wayne L. Winston
Publisher:Brooks Cole
Text book image
C++ for Engineers and Scientists
Computer Science
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Course Technology Ptr
Text book image
C++ Programming: From Problem Analysis to Program...
Computer Science
ISBN:9781337102087
Author:D. S. Malik
Publisher:Cengage Learning
Program to find HCF & LCM of two numbers in C | #6 Coding Bytes; Author: FACE Prep;https://www.youtube.com/watch?v=mZA3cdalYN4;License: Standard YouTube License, CC-BY