Question
Challenge exercise Write a method to play every track in the track list exactly once in random order. Hint: One way to do this would
Challenge exercise Write a method to play every track in the track list exactly once in random order. Hint: One way to do this would be to shuffle the order of the tracks in the list - or, perhaps better, a copy of the list - and then play through from start to finish. Another way would be to make a copy of the list and then repeatedly choose a random track from the list, play it, and remove it from the list until the list is empty. Try to implement one of those approaches. If you try the first, how easy is it to shuffle the list so that it is genuinely in a new random order? Are there any library methods that could help with this? Please help me with the method. I have been able to write a method that plays the tracks in a random order, but I cannot get it to play each track once. I have been attempting to use an iterator. This needs to be from exercise 4.45 in Objects First with Java 6th edition. The solution in the Textbook Solutions is not correct.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started