Employers may have regular or routine drug tests for their forklift operators to ensure that the workplace is drug-free. They have a big reason to do that. Drug addiction interferes with forklift operators' minds, increasing the chance of committing mistakes that could lead to serious accidents and fatality. To handling this issue each week, the Wal-Mart distribution center randomly selects one of its 30 forklift operators to take a drug test. Write an application that determines which employee will be selected each week for the next 52 weeks. Use the Math.random() function to generate an employee number between 1 and 30; you use a statement similar to:  testedEmployee = 1 + (int) (Math. random() * 30); After each selection, display the number of the employee to test. Display four employee numbers on each line. It is important to note that if testing is random, some employees will be tested multiple times, and others might never be tested. Run the application several times until you are confident that the selection is random. Save the file as DrugTests.java. b. Now modify the program to include a count and display of the number of times each employee is selected. Also display a list of employee numbers that never were selected for testing. Save the program as DrugTests2.java. c. When a series of random numbers is generated, it is quite common for the same number to be selected consecutively multiple times. Although duplicates happen in randomized lists, humans tend to see such repetition as “unfair.” Modify the DrugTests2 class so that if an employee number is selected immediately after it was already selected, a new number is selected for the week. Also display a message explaining that a new number is being selected. Save the file as DrugTests3.java.

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

Employers may have regular or routine drug tests for their forklift operators to ensure that the
workplace is drug-free. They have a big reason to do that. Drug addiction interferes with forklift
operators' minds, increasing the chance of committing mistakes that could lead to serious accidents
and fatality. To handling this issue each week, the Wal-Mart distribution center randomly selects
one of its 30 forklift operators to take a drug test. Write an application that determines which
employee will be selected each week for the next 52 weeks. Use the Math.random() function to
generate an employee number between 1 and 30; you use a statement similar to:  testedEmployee = 1 + (int) (Math. random() * 30);

After each selection, display the number of the employee to test. Display four employee numbers on each
line. It is important to note that if testing is random, some employees will be tested multiple times, and others
might never be tested. Run the application several times until you are confident that the selection is random.
Save the file as DrugTests.java.
b. Now modify the program to include a count and display of the number of times each employee is
selected. Also display a list of employee numbers that never were selected for testing. Save the
program as DrugTests2.java.
c. When a series of random numbers is generated, it is quite common for the same number to be
selected consecutively multiple times. Although duplicates happen in randomized lists, humans
tend to see such repetition as “unfair.” Modify the DrugTests2 class so that if an employee number
is selected immediately after it was already selected, a new number is selected for the week. Also
display a message explaining that a new number is being selected. Save the file as
DrugTests3.java.

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 6 steps with 11 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY