You can implement the probability of a shot hitting the target in the following way. Gunfighter should
Fantastic news! We've Found the answer you've been seeking!
Question:
You can implement the probability of a shot hitting the target in the following way. Gunfighter should have a Random (an instance of the class Random, which is part of the JDK) called r. In the concrete shoot() methods, call the method r.nextDouble(). If the result returned is less than the accuracy, the shot is successful. If not, the shot misses.
Posted Date: