Employers may have regular or routine drug tests for their forklift operators to ensure that the workplace
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: 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
Engineering Economic Analysis
ISBN: 9780195168075
9th edition
Authors: Donald Newnan, Ted Eschanbach, Jerome Lavelle