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
Write the SQL code that permits to implement the tables: Student and Transcript. NB: Add the constraints on the attributes – keys and other.
Draw an ERD that will involve the entity types: Professor, Student, Department and Course. Be sure to add relationship types, key attributes, attributes and multiplicity on the ERD.
Draw an ERD that represents a book in a library system. Be sure to add relationship types, key attributes, attributes and multiplicity on the ERD.
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
Text book image
Microsoft Visual C#
Computer Science
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Cengage Learning,
Text book image
Programming Logic & Design Comprehensive
Computer Science
ISBN:9781337669405
Author:FARRELL
Publisher:Cengage
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