Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Many applications use random numbers (to simulate uncertainty,to avoid patterns

ID: 3613027 • Letter: M

Question

Many applications use random numbers (to simulate uncertainty,to avoid patterns that can cause inefficiency, to make successiveexecutions of the same program behave differently). Javaprovides at least 2 ways to do this. Let's use the class Randomfrom the java.util package.

1) write a few statements that will print the sum of 5randomly chosen integers, equally likely to be 0,1,...,9.

2) write a few statements that will print 10 rolls of apair of dice. (The value of each roll will be between 2 and 12 but7 will be the most likely roll.)

Explanation / Answer

please rate - thanks import java.util.*; public class untitled {public static void main(String[] args) {Random random = new Random(); int sum=0,num,i; System.out.print("The numbers are: "); for(i=0;i
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote