Using Eclispe Java Programming, How Do I Make A Random Horse Race?
Can anyone give me a code for this assignment: There are a number of horses and each round each horse has a random number generated from 1 to 100 that will advance the horse along the race track if the number is greater than 50. You can have as many horses as you'd like, up to 15. Also, you can make the race as long as you'd want. All work has to be done in methods and/or arrays. 1|----------H-----------| 2|--------------H-------| 3|---H------------------| I was also wondering if there was a way for me to put pictures in, if anyone knows how, all help is greatly appreciated. Thank you! PS- It does not have to be in Eclipse, I just need to be able to run it on there.
Public Comments
- I don't do homework assignments, but let me give you some advice on this project: Begin with a single horse. Figure out how to get the random number and make it move when it should. Make a method to display the horse's position. (You'll need a variable to keep track of the horse's position. If you've started object-oriented programming, you may want to make each horse an object. This will simplify the next step. Once you've got things working for a single horse, make an array of them. Keep track of the data for each horse in an array. If you're doing OOP, make an array of horses. If you haven't gotten there yet, you'll need an array of positions (integers) Use a for loop to step through the array of horses, calculating the likelihood each one advances. Continue this process using a while loop until one of the horses completes the race. Don't bother with graphics right now. They complicate things and take away from the real goal, which is to ensure you understand arrays and functions. That's a great assignment. I may have to use that one myself...
Powered by Yahoo! Answers