Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write Program in JAVA Programming Language Problem 2 (B Grade): Radio Network Instead of a single radio station, your program has to make play-lists for

Write Program in JAVA Programming Language

Problem 2 (B Grade): Radio Network

Instead of a single radio station, your program has to make play-lists for several radio stations that share the same song list. But, each radio station has its own demographic, which will result in song ratings that vary from station to station. Given a list of songs, and sequences of daily song requests for your radio stations, your program will need to create a play-list of a specifed length for each of the radio stations. Write a program called RadioNetwork.java that reads in a song list, a list of radio stations, and a sequence of song requests, spanning multiple days, and outputs a play-list for each radio station of specied length for each following day.

Input

The input comprises a number of lines. The first line, contains an integer N, denoting the number of songs in the song list. This is followed by N lines, enumerating the songs. Each line consists of three values: a single word, denoting the title of the song; an integer T, denoting the length of the song (in seconds); and decimal value between 0 and 1 denoting the initial popularity of the song. For example: Red_Barchetta 371 0.5

The song list is followed by two integers: an integer S, denoting the number of stations; and an integer D denoting the number of days, . These are followed by S radio station specifications. Each station specification consist of: a station identifier; the length of the play-list, T, in minutes ; and the weight W For example, CBC1 22 0.5 The last part of the input are the requests, except that each request consists of two words: the identifier of the radio station to which the request was sent and the song title. For example, CBC1 The_Garden Please see full example below.

Processing

1) The day 0 of programming begins after the list is read. Each following day begins after a day of song requests have been read.

2) The play-list should be as close to the specified time T as possible without exceeding T minutes.

3) Songs should be added to the list according to popularity (most popular to least pop- ular), with ties broken by song length. For example, if two songs are equally popular, the shorter one is preferred.

4) If a song is too long to t on the play-list, it is passed over.

5)The order of the songs on the play-list should be the order in which they were added.

Each radio station can have its own length of play-list T and its own weight W. A song request aspects the ratings of a song at the specified radio station and not all radio stations. That is, the request rate Rt for a song at a radio station is Rt = (# of requests for the song on day t at specified radiostation) / (Total # of requests on day t at specified radiostation) Each station's requests are only counted for the specified radio station. Output For each day (0 ...D) your program should output a play-list for each radio station. I.e., there should be S (D + 1) play-lists. The output for each day begins with an integer denoting the day. This is followed by S lines, each displaying a play-list for a radio station. Each play-list consists of single line. Each line has the format: + Station: Song1 Song2 Song3 ... For example, + CBC1: Closer_To_The_Heart The_Garden Red_Sector_A The_Pass Each line is terminated by a new-line character. The play-lists should be in the same order as the input order of the radio stations. Example Sample Input 13 The_Garden 419 0.7 Red_Sector_A 311 0.6 High_Water 333 0.4 Red_Barchetta 371 0.5 The_Pass 291 0.55 Roll_The_Bones 330 0.45 Arm_And_Sword 396 0.55 Test_For_Echo 356 0.35 Vapor_Trails 358 0.34 Nobodys_Hero 349 0.22 2112_Overture 1232 0.7 Closer_To_The_Heart 175 0.9 Cygnus_X_1 622 0.2 3 1 CBC 22 0.5 CBC1 22 0.5 CBC2 22 0.5 5 CBC Red_Sector_A CBC1 Red_Sector_A CBC2 Vapor_Trails CBC Red_Sector_A CBC Test_For_Echo Sample Output 0 + CBC: Closer_To_The_Heart The_Garden Red_Sector_A The_Pass + CBC1: Closer_To_The_Heart The_Garden Red_Sector_A The_Pass + CBC2: Closer_To_The_Heart The_Garden Red_Sector_A The_Pass 1 + CBC: Red_Sector_A Closer_To_The_Heart The_Garden Test_For_Echo + CBC1: Red_Sector_A Closer_To_The_Heart The_Garden The_Pass + CBC2: Vapor_Trails Closer_To_The_Heart The_Garden Red_Sector_A

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Building The Data Lakehouse

Authors: Bill Inmon ,Mary Levins ,Ranjeet Srivastava

1st Edition

1634629663, 978-1634629669

More Books

Students also viewed these Databases questions

Question

Which is the best idea?

Answered: 1 week ago

Question

4 How can you create a better online image for yourself?

Answered: 1 week ago