All Questions
Tagged with java simulation
59 questions
1
vote
2
answers
154
views
ProducerConsumerSimulation.java: practicing concurrent programming in Java
Intro
This time, I was in the mood for concurrent programing (ProducerConsumerSimulation.java). To this end, I have ended up with the code below. My primary concerns are:
Class design is trash,
The ...
2
votes
1
answer
188
views
Java program for calculating probabilities of die combinations in Yatzy
Yatzy
Yatzy is a dice rolling game where players aim to get particular die combinations.
This program counts probability of each such combinations. They are:
All five ones,
All five twos,
Same for ...
1
vote
1
answer
219
views
Simulating a toilet seat usage in Java - follow-up
(See the previous iteration.)
This time, I removed the stuff I don't need in my demo runner. Also, I consolidated some code that seemed DRY to me.
Simulation rules
When a female arrives, she ensures ...
3
votes
2
answers
153
views
Simulating a toilet seat usage in Java
(See also the next iteration.)
I have this small simulation program simulating a toilet seat. The toilet seat may be in two positions: up or down. If a male arrives to the toilet to urinate, and ...
4
votes
2
answers
1k
views
Traffic simulation GUI: an exercise in concurrent programming using threads
To avoid a code dump I have removed most of the code and left the first few lines of constructors and methods and anything relevant. Full code at the bottom.
The purpose of this code is to use threads ...
1
vote
4
answers
381
views
Given the arrival times of people at a door, resolve their passage times
I was trying to solve the following question:
You are given 2 arrays: one representing the time people arrive at a door and other representing the direction they want to go (in or out) You have to ...
5
votes
2
answers
321
views
A type of game simulation dropping disks
Quincunx is that little game where you drop a ball or disk down rows of nails in a pyramid formation until they land in a slot. This was a project for my class, but it's already been submitted. I am ...
6
votes
2
answers
6k
views
Fast Food Order Simulator
I have been trying learn OOP lately, and have made a simple program that simulates some sort of drive thru experience using a 9 digit keypad to add, delete, and pay for items ordered from the menu.
...
2
votes
1
answer
161
views
Code which creates the Game Of life In Java
Link to github
Link to github: https://github.com/zombi3123/Game-Of-Life/
Source code:
Window.Java
...
4
votes
3
answers
232
views
Simulation of forest growth and pruning
I was wondering how I could streamline the following code. This was the project assigned to us:
The Canadian Forest Service wants to do a simple simulation of the growth and pruning of forests. ...
2
votes
1
answer
164
views
Incrementing time in a discrete-event simulation of a supermarket queue
A method has been written that increments time in minutes that simulates how much time it takes to process item in a supermarket queue and if there is an empty queue, skip it and loops around to find ...
4
votes
2
answers
326
views
Follow up Implementation on Monty Hall Simulation
I have taken your inputs on my original question and formed a new implementation of the Monty Hall Simulation:
Again keep an eye on CleanCode and OOP
The Price to be won:
...
1
vote
1
answer
330
views
Counting results of die rolls
The algorithm bellow is meant to allow a user to roll a die as many times as he would like, then print how many times each side was rolled and how many rolls there were total.
...
3
votes
2
answers
2k
views
Extending Combo from Food in FoodOrder Simulator
This is an assignment and I'm trying to improve upon the design factor. Honestly the task seems very trivial to use inheritance so I kind of did it for the sake of doing it. The problem description ...
7
votes
3
answers
7k
views
Discrete Event Simulator
I'm an undergraduate student and I have this assignment on a Discrete Event simulator. Currently I have completed to the end of v1.2 here. Attached also, is an algorithmic overview.
I have wrote my ...