1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Andru [333]
3 years ago
6

Each week, the Pickering Trucking Company randomly selects one of its 30 employees to take a drug test. Write an application tha

t determines which employee will be selected each week for the next 52 weeks. Use the Math. random() function explained in Appendix D 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.

Computers and Technology
1 answer:
Sati [7]3 years ago
3 0

Answer:

Following are the program to this question:

import java.util.*; //import package

public class Main //defining class

{

 public static void main(String[] args) //defining main method

 {

   int testedEmployee; //defining integer variable

   for(int i = 1;i<=52;i++) //defining loop that counts from 1 to 52  

   {

     testedEmployee = 1 + (int) (Math.random() * 30); //using random method that calculate and hold value

     System.out.print(testedEmployee+"\t"); //print value

     if(i%4 == 0)//defining codition thats checks value is divisiable by 4  

     {

       System.out.println(); //print space

     }

   }

 }

}

Output:

please find the attachment.

Explanation:

In the given java program, a class Main is declared, inside the class, the main method is declared, in which an integer variable "testedEmployee", is declared, in the next line, the loop is declared, that can be described as follows:

  • Inside the loop, a variable "i" is declared, which starts from 1 and stop when its value is 52, inside the loop a random method is used, that calculates the random number and prints its value.
  • In the next step, a condition is defined, that check value is divisible 4 if this condition is true, it will print a single space.

You might be interested in
Which TWO objects are likely to have SSD chips in them?
valentina_108 [34]
Bank card and discount coupon
8 0
2 years ago
Read 2 more answers
Role of User Defined Iprms for creation of paten
Mazyrski [523]

Answer:

3

Explanation:

3 0
2 years ago
How to share excel file for multiple users office 365?.
Sholpan [36]

Answer:

You would need that person email to share it with them.

5 0
2 years ago
Read 2 more answers
How does the occupational outlook affect the monetary benefits of a career
Ksivusya [100]
If there are changes to the responsibilities in a career, the typical outcome will change.
4 0
3 years ago
Write a repetition statement that outputs the numbers 45 , 51 , . . . , 165 . That is, all of the multiples of 6 in increasing o
Bingel [31]

Answer:

#include <iostream>

using namespace std;

int main()

{

   int i = 45;

   for ( i = 45; i <=165; i = i + 6)

       cout << i << endl;

}

Explanation:

I corrected your code and highlighted the mistakes. Even though you wrote the correct algorithm, your code did not compile because of the typos you made.

Remember, C++ is a case-sensitive language. That means, "For" is not same as "for".

Generally, variables and keywords are written in lower case. Of course, there are exceptions, such as constant variables are all written in uppercase letter and class names start with an uppercase letter.

8 0
3 years ago
Other questions:
  • A DSLR camera is made up of two parts. They are
    13·2 answers
  • What is a color that cannot be created by mixing other colors together?
    15·2 answers
  • With a _____ network connection, the computers and other devices on the network are physically connected via cabling to the netw
    13·1 answer
  • Why might a government entity choose to offer some information and services online as in e-government
    8·2 answers
  • : How does the founder of Wikipedia keep a tight reign on accuracy? HELP PLEZ AT LEAST A PARGRAPH PLES
    6·1 answer
  • For the sake of maximizing hardware utilization in a multicore system with a many to many threading model, the relationship of t
    12·1 answer
  • I live in Pennsylvania which observes eastern standard time.
    13·1 answer
  • The most effective technique of malware propagation among the following list
    7·1 answer
  • Suppose you are working in a computer lab during the work you are facing window failure or other technical issues.How you will s
    12·1 answer
  • Explain the working principle of computer with suitable diagram​
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!