Create a class named H3_Q2.java to accomplish the following tasks. a. Add a loop that generates 10,000 discrete random numbers betweewn a = 10 and b = 100. The formula for generating a discrete uniform random number is DU(a, b) = bU(0, 1) × (b − a + 1)c + a where a and b are integers, a ≤ b, b c is the floor operator and U(0, 1) is a uniform random variable between 0 and 1 (hint: we generated U(0, 1) values in class). 1 b. For the 10,000 random numbers generated in a., add code that counts the total number of times that the random value generated is in either of the following ranges: [0,2] or [16,44]. Print this total to the screen with an appropriate label. c. Write a loop the continues to generate random floating-point numbers between 0 an 1 until the random value generated exceeds 0.9. Write every value generated to an output file named Q2cOutput.txt located in a directory named output_files. Print out the number of times the loop was executed to the same file with an appropriate label.

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

Create a class named H3_Q2.java to accomplish the following tasks.
a. Add a loop that generates 10,000 discrete random numbers betweewn a = 10 and b = 100. The formula
for generating a discrete uniform random number is
DU(a, b) = bU(0, 1) × (b − a + 1)c + a
where a and b are integers, a ≤ b, b c is the floor operator and U(0, 1) is a uniform random variable
between 0 and 1 (hint: we generated U(0, 1) values in class).
1
b. For the 10,000 random numbers generated in a., add code that counts the total number of times that
the random value generated is in either of the following ranges: [0,2] or [16,44]. Print this total to the
screen with an appropriate label.
c. Write a loop the continues to generate random floating-point numbers between 0 an 1 until the random
value generated exceeds 0.9. Write every value generated to an output file named Q2cOutput.txt
located in a directory named output_files. Print out the number of times the loop was executed to
the same file with an appropriate label.

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Developing computer interface
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education