Question
This for a JAVA Course, See below and this program should use two classes one would be the Playlist. java class which would hold the
This for a JAVA Course, See below and this program should use two classes one would be the Playlist. java class which would hold the ArrayList songList, getList() method, and shuffleList() method [which in this case would be Yates shuffling algorithm]. The second class should be a PlaylistTester.java class which would have the readFile() and writeFile() methods [likely using BufferedReader & FileWriter], and there should be a main method in this tester class which would read the file, print, write the file, and then print.
-----------------------------------------------------
You are planning a road trip and want to create a playlist of your favorite songs. Assume that the song titles are in an array of strings. Create a shuffle of your songs (permutation of your original songs). Use the Fisher-Yates shuffle algorithm that works in (n) running time. We will use a method that creates pseudo-random numbers (see end for help) in O(1) running time The basic idea is to start from the last element, swap it with a randomly selected element from the whole array (including last). In the next step you will consider the array from 0 to n-2 (size reduced by 1), and repeat the process until you reach the first element. Write a program that uses the provided Playlist.txt as input and outputs the shuffled array in a file called LastNameFirstNamePlaylist.txt. Follow the next pseudocode: To shuffle an array a of n elements (indices 0.n-1): for i-n-1 downto 1 j random integer with 0Step 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