Join Peggy Fisher for an in-depth discussion in this video Challenge: Monte Carlo, part of Java Essential Training for Students.
- OK, it's challenge time.…In this challenge, let's use the Monte Carlo simulation…to calculate the probability of selecting a certain marble…from a bowl of marbles.…I want you to estimate the probability…of getting three of the same color marbles…if you randomly select the marbles from a bowl…that has a total of six marbles.…Three are white, and three are blue.…I think for this challenge, I'd like to give you…a series of steps that you can follow, or an algorithm.…
Start by creating unique variables,…one to represent whether or not it's a blue marble,…and one for whether or not it's a white marble.…Add variables to keep track of the attempts,…and the number of successes.…Then set up your loop for the simulation.…Create an array to simulate the bowl.…So the array will have six objects…that hold the unique variables for blue and white.…Three of those objects should represent blue…and three should represent white at the beginning.…Create a second array that only has three marbles.…
This array holds the marbles that were randomly selected.…
- Getting started with parsing
- Reviewing data types
- Using decisions
- Creating user-defined methods
- Command-line debugging
- Exploring the Java API
- Creating and instantiating classes
- Working with interfaces
- Storing items with arrays
Skill Level Intermediate
Q: How can I make my debugger function like the author’s?
<div>A: When you are debugging your program in NetBeans, if you do not see the new contextual items on the menu bar for stepping into your code, check to see if the source file is accidentally deselected.</div><div> </div><div>Highlight the program you want to debug in your projects folder. In the menu bar, choose Windows > Debugging > Sources. A new window will appear with the file path name. If the checkbox is not selected, click the box to select this file.</div><div> </div><div>Now you can go back to your program and rerun the debug operation on your code.</div>
1. Command Level Programming
2. Basics Review
4. Java API
5. Simulations and Algorithm Analysis
6. Classes and Objects
7. More on Classes
8. Data Structures
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.