Neetu S.

asked • 03/22/21

The program is for randomising a given playlist according to the conditions given.

The program should then generate a random playlist of the songs given as input, according to the following constraints:

  1. An artiste cannot have more than two songs in a row (so no “triple play”, as the radio DJs might say);
  2. An artiste cannot have more than three songs in total in the playlist;
  3. A song cannot appear twice in the playlist;
  4. The total playlist length should be as close as possible to one hour. Specifically, the last song must start on or before 59:59.
  5. The randomised playlist and the total time should be printed out in the following format:
Randomised playlist
Artiste name: "Song title" (Song duration)
Artiste name: "Song title" (Song duration)
...
Artiste name: "Song title" (Song duration)
Total duration: <Total duration>.


An example randomised playlist would be the following:

Randomised playlist
Public Service Broadcasting: "They Gave Me A Lamp" (3:56)
The War on Drugs: "Under the Pressure" (8:51)
Future Islands: "Spirit" (4:22)
Arcade Fire: "Cold Wind" (3:12)
The National: "England" (5:40)
Bon Iver: "re: Stacks" (6:40)
Sufjan Stevens: "Chicago [To String Remix]" (5:32)
Jos Gonzlez: "Heartbeats" (2:40)
Public Service Broadcasting: "The Other Side" (6:20)
Public Service Broadcasting: "Go!" (4:13)
Arcade Fire: "Rebellion (Lies)" (5:10)
London Grammar: "Wasting My Young Years" (3:24)
Total duration: 60:00.


1 Expert Answer

By:

Patrick B. answered • 03/23/21

Tutor
4.7 (31)

Math and computer tutor/teacher

Neetu S.

Is this code in c programming language ? Plus can you give me you mail I can't open the link.
Report

03/23/21

Neetu S.

Can I get this code in c language? Thanks
Report

03/25/21

Patrick B.

Yes
Report

03/25/21

Patrick B.

There ya go
Report

03/27/21

Still looking for help? Get the right answer, fast.

Ask a question for free

Get a free answer to a quick problem.
Most questions answered within 4 hours.

OR

Find an Online Tutor Now

Choose an expert and meet online. No packages or subscriptions, pay only for the time you need.