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

Videos

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

Estimate the Pi value

Program plan:

  • Import the header file.
  • Define the main method.
    • Read the iteration value from the user
    • Call the “simDarts” method
    • Call the “getPi” method
    • Call the “printSummary” method
  • Define the “simDarts” methods
    • Set the window size
    • Set the coords
    • Set the value
    • Iterate “i” until it reaches “n” value
      • Call the “getDarts” method
      • Check the condition
        • Increment the “hits” value
      • Otherwise, set the value
          • Close the window
          • Return the value
  • Define the “getDarts” method
    • Get the “x” and “y” values
    • Check the calculate of value is less than or equal to 1
      • Return true
          • Otherwise, return false
  • Define “getPi” method
    • Calculate the “pi” value
    • Return “pi” value
  • Define “printSummary” method
    • Display the output
  • Call the function “main()”.

Blurred answer
Students have asked these similar questions
A coin is flipped 8 times in a row (assume all outcomes are equally likely). For each of the following questions, you should write your answer as an expression. Do not give the final numeric value. For example, you should write C(4,2)/24 instead of 0.375. Q1.1 What is the probability that it lands on heads exactly four times?
There are two isotopes of an unknown element, X-19 and X-21. The abundance of X-19 is 14.29%. A weighted average uses the percentages of each isotope to scale their contribution to the total mass. Each isotope's contribution is the percentage (in decimal form) multiplied by the mass of the isotope. What is the contribution (in amu) to the weighted average from the X-19 isotope, which has a mass of 19.00 amu?
Use the Crosswind Method 1 - with sin to solve the questions below. You are advised by the tower for landing, 350/16 on runway 3. 1. What is the angle you are going to use? 2. What is the crosswind component of the wind speed in kn? Round the answer to nearest whole number
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
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Text book image
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Text book image
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
Text book image
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Text book image
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Text book image
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education
Java random numbers; Author: Bro code;https://www.youtube.com/watch?v=VMZLPl16P5c;License: Standard YouTube License, CC-BY