C++ How to Program (10th Edition)
10th Edition
ISBN: 9780134448237
Author: Paul J. Deitel, Harvey Deitel
Publisher: PEARSON
expand_more
expand_more
format_list_bulleted
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
DO NOT USE EXISTING ANSWERS ON CHEGG OR COURSE HERO OR ANY OTHER SERVICES PLEASE! Thanks :)
CODE IN PYTHON AND SHOW COMMENTS TO EXPLAIN CODE
A confused Dutchman trying to speak English could say “I am in the war”, even though there is no hostile activity going on. The confusion1 here is that the English sentence “I am confused” is translated in Dutch as “Ik ben in de war”, which is phonetically (“sounding”) quite close to the first sentence. Such confusion leads to much enjoyment, but can complicate matters a bit.
Given a sentence in Dutch and a dictionary containing both correct translations as well as phonetic (incorrect) translations of individual words, find the translation of the sentence and indicate whether it is correct, or in case there is more than one find the total number of correct and incorrect translations. A sentence is correctly translated when each word of the sentence is correctly translated.
Input
The input consists of:
One line with an integer n (1≤n≤20), the…
Python
(python)
Write the program based on the details in the picture and the additional details below.
Since this is a simulation, we will not prompt the user for inputs. Any inputs will result in a loss of points. To determine the radius of the circle, add together your Birth Month and Day. So my radius would be 41.
NOTE: this radius will be used for all of the simulation trials.
Once you have the radius, implement the Monte Carlo simulation with 500,000 random (x,y) points (remember to make them floats) and display the results of 10 trials. Each trial does another simulation of 500,000 random (x,y).
Display the following for each trial:
Trial number
Number of hits inside the circle from the simulation
The percentage of hits (Only want 2 decimal places)
At the end you must display the average percentage for all 10 trials.
Bonus Option:
Create an 11th trial and create a graphic representation of the simulation.
Draw a square and corresponding circle (you do not need the grid)
Draw each…
Chapter 6 Solutions
C++ How to Program (10th Edition)
Ch. 6 - Show the value of x after each of the following...Ch. 6 - (Parking Charges) A parking garage charges a...Ch. 6 - Prob. 6.13ECh. 6 - (Rounding Numbers) Function floor can be used to...Ch. 6 - Prob. 6.15ECh. 6 - (Random Numbers) Write statement that assign...Ch. 6 - (Random Numbers) Write a single statement that...Ch. 6 - Prob. 6.18ECh. 6 - Prob. 6.19ECh. 6 - Prob. 6.20E
Ch. 6 - Prob. 6.21ECh. 6 - Prob. 6.22ECh. 6 - Prob. 6.23ECh. 6 - (Separating Digits) Write program segments that...Ch. 6 - (Calculating Number of Seconds) Write a function...Ch. 6 - (Celsius and Fahrenheit Temperature) Implement the...Ch. 6 - (Find the Minimum) Write a program that inputs...Ch. 6 - Prob. 6.28ECh. 6 - (Prime Numbers) An integer is said to be prime if...Ch. 6 - Prob. 6.30ECh. 6 - Prob. 6.31ECh. 6 - (Quality Points for Numeric Grades) Write a...Ch. 6 - Prob. 6.33ECh. 6 - (Guess-the-Number Game) Write a program that plays...Ch. 6 - (Guess-the-Number Game Modification) Modify the...Ch. 6 - Prob. 6.36ECh. 6 - Prob. 6.37ECh. 6 - Prob. 6.38ECh. 6 - Prob. 6.39ECh. 6 - Prob. 6.40ECh. 6 - Prob. 6.41ECh. 6 - Prob. 6.42ECh. 6 - Prob. 6.43ECh. 6 - Prob. 6.44ECh. 6 - (Math Library Functions) Write a program that...Ch. 6 - (Find the Error) Find the error in each of the...Ch. 6 - (Craps Game Modification) Modify the craps program...Ch. 6 - (Circle Area) Write a C++ program that prompts the...Ch. 6 - (pass-by-Value vs. Pass-by-Reference) Write a...Ch. 6 - (Unary Scope Resolution Operator) What’s the...Ch. 6 - (Function Templateminimum) Write a program that...Ch. 6 - Prob. 6.52ECh. 6 - (Find the Error) Determine whether the following...Ch. 6 - (C++ Random Numbers: Modified Craps Game) Modify...Ch. 6 - (C++ Scoped enum) Create a scoped enum named...Ch. 6 - (Function Prototype and Definitions) Explain the...Ch. 6 - Prob. 6.57MADCh. 6 - Prob. 6.58MADCh. 6 - (Computer-Assisted Instruction: Monitoring Student...Ch. 6 - (Computer-Assisted Instruction: Difficulty Levels)...Ch. 6 - (Computer-Assisted Instruction: Varying the Types...
Knowledge Booster
Similar questions
- RECURSION 1 Good day please help me with this practice exercise for our upcoming exam on last week of january.. I promise to give helpful rating after. Note: Please give the output of the program in the picture Please write your answer on a PAPER the tracing of the program in the picture. The answer should explain step by step on how I will get the output. Please refer to the second photo a sample tracing on how you would trace the first picture.. AGAIN 2ND PHOTO IS ONLY A SAMPLE ON HOW TO TRACE THE PROGRAM.arrow_forward1) Simple Calculator: In Python, implement a simple calculator that does the following operations: summation, subtraction, multiplication, division, sqrt, power, natural log and abs. a) Follow the instructions below: To work with the calculator, the user is asked to enter the first number, then the operation, and finally, a second number if required. Your code has to recognize the need for the second number and ask for it if required. After performing one operation, the calculator prints the output of the operation. After performing one operation, the calculator must not exit. It has to start again for the next operation. The calculator will be closed if the user writes 'e' as any input. Use functions to perform the operations and the appropriate conditions to prevent common errors such as entering characters as one of the numbers etc. b) Run your code and provide the results for at least one example per operation. - -arrow_forwardObject-Oriented Programming ------------------------------------arrow_forward
- Task #1 Tracing Recursive Methods 1. Copy the file Recursion.java (see Code Listing 16.1) from the Student Files or as directed by your instructor. 2. Run the program to confirm that the generated answer is correct. Modify the factorial method in the following ways: a. Add these lines above the first if statement: int temp; System.out.println ("Method call "calculating "Factorial of: " + n); Copyright © 2019 Pearson Education, Inc., Hoboken NJ b. Remove this line in the recursive section at the end of the method: return (factorial(n - 1) * n); c. Add these lines in the recursive section: temp - factorial (n - 1) ; System.out.println ("Factorial of: " + (n - 1) + " is " + temp); return (temp * n); 3. Rerun the program and note how the recursive calls are built up on the run-time stack and then the values are calculated in reverse order as the run-time stack "unwinds".arrow_forwardDo not use static variables to implement recursive methods. USING JAVA 1. Using Big Oh notation, indicate the time requirement for each of the following tasks in the worst case. Describe which operations are assumed to take constant time to. After arriving at a party, you shake hands with each person there. n is the number of persons in the party. Each person in a room shakes hands with everyone else in the room. n is the number of persons in the room. You climb a flight of stairs. n is the number of stairs After entering an elevator, you press a button to choose a floor. n is the number of floors You ride the elevator from the ground floor up to the nth floor. You read a book twice. n is the number of pages in the book Using Big Oh notation, indicate the time requirement of each of the following tasks in the worst case. Display all the integers in an array of integers. Display all the integers in a chain of linked nodes. Display the nth integer in an array of integers. Compute…arrow_forwardflow chart and dimple program. Python thank youarrow_forward
- ANSWER IN PYTHON PLEASE.arrow_forwardLoops summary: for vs. while We have now seen that Python has two different loop constructs: the for loop and the while loop. The while loop is more powerful than the for loop, since it can be used in situations where the number of iterations isn't known in advance. For example, the following while loop answers the question: "If a population of bacteria increases in size by 21% every minute, how long does it take for the population size to double?" minutes = 0 population = 1000 growth_rate = 0.21 while population < 2000: population *= (1 + growth_rate) minutes += 1 print (f"{minutes} minutes required.") print (f"Population = {int(population)}") This would not be well suited to a for loop - we are trying to find out how many times the loop will run, and a for loop expects to know how many times it will run before it starts. In contrast, the for loop is a special case of the more general while loop, meaning that any program written with for loops can be rewritten to use while loops.…arrow_forward(YOU ARE NOT ALLOWED TO USE ARRAYLIST IN THIS PROJECT)Write a Java program to simulate a blackjack game of cards. The computer will play the role of the dealer. The program will randomly generate the cards dealt to the player and dealer during the game. Cards in this game will be represented by numbers 1 to 13 with Ace being represented by a 1. Remember, that face cards (i.e. Jack, Queen, and King) are worth 10 points to a hand while an Ace can be worth 1 or 11 points depending on the user’s choice. The numbered cards are worth their number value to the hand.arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- C++ Programming: From Problem Analysis to Program...Computer ScienceISBN:9781337102087Author:D. S. MalikPublisher:Cengage LearningC++ for Engineers and ScientistsComputer ScienceISBN:9781133187844Author:Bronson, Gary J.Publisher:Course Technology Ptr
C++ Programming: From Problem Analysis to Program...
Computer Science
ISBN:9781337102087
Author:D. S. Malik
Publisher:Cengage Learning
C++ for Engineers and Scientists
Computer Science
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Course Technology Ptr