Question: 1. Write a program that generates a sequence of 20 random die tosses in a list and that prints the die values, marking only the

1. Write a program that generates a sequence of 20 random die tosses in a list and that prints the die values, marking only the longest run, like this: 1 2 5 5 3 1 2 4 3 (2 2 2 2) 3 6 5 5 6 3 1 If there is more than one run of maximum length, mark the first one.

2. Write a program that produces ten random permutations of the numbers 1 to 10. To generate a random permutation, you need to fill a list with the numbers 1 to 10 so that no two entries of the list have the same contents. You could do it by brute force, by generating random values until you have a value that is not yet in the list. But that is inefficient. Instead, follow this algorithm.

Make a second list and fill it with the numbers 1 to 10.

Repeat 10 times

Pick a random element from the second list.

Remove it and append it to the permutation list.

3. Implement a class Student. For the purpose of this exercise, a student has a name and a total quiz score. Supply an appropriate constructor and methods getName(), addQuiz(score), getTotalScore(), and getAverageScore(). To compute the latter, you also need to store the number of quizzes that the student took.

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!