Question: Write a static method named instructions that takes a Random object and an integer parameter representing the number of minutes that a student is in

Write a static method named instructions that takes a Random object and an integer parameter representing the number of minutes that a student is in class and prints whether or not a student is listening for every 15 minutes. At the end of the method, you should return true if the students were listening 100% of the time, false if they were not listening at any time.

You will need to calculate the quarter-hour (15-minute) increments, making sure that if the division is not even, that you still report on the remaining minutes. For example, for the method call instructions(r, 35), there should be three lines of output (15, 15, 5); for the method call instructions(r, 10), there should be one line of output (10); for the method call instructions(r, 45), there should be three lines of output (15, 15, 15).

We will assume for this problem that when teachers give instructions to students, they don't listen about 25% of the time (a 1/4 likelihood of not listening). The method should use the Random object to select numbers in the range of 1 to 4 inclusive, where each number is equally likely to be chosen, for simulating the probability of students listening. If students are listening during the quarter-hour (15 minute increment), then "listening" should be printed to the screen. If the students were not listening, "not listening" should be printed to the screen.

just a static method no main no import.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!