Question: Group - name : String -channels Channel - name : String - language : String - views : int - live : boolean #nbProgs +



Group - name : String -channels Channel - name : String - language : String - views : int - live : boolean #nbProgs + Channel(String, String, int, boolean) + addProgram(Program): boolean + getName(): String + getLanguage(): String + getViews(): int + isLive(): boolean + calculate Rating(): double + display(: void Program - audienceRating : double #programs + Program(double) 30+ getAudienceRating(): double + toString(): String + Group(String, int) addChannel(Channel): boolean + removeChannel(String): boolean 1 + countLive Sports(String, int): int + getNews(int, double): News[] 1 Sports News - matches: int - segments: int -breaking : int + Sports(String, String, int, boolean, int) + getMatches(): int + News(String, String, int, boolean, int, int) + getBreaking(): int Program class: Attributes: o audienceRating: the audience rating of the program Methods: o Program(double audienceRating): constructor o getAudienceRating(): returns the audience rating of the program otoString(): returns a string representing the info of the program Channel class: Attributes: o name: the name of the channel o language: the language of the channel o view: the number of views for the channel o live: attribute that indicates if the channel is live or not onbProgs: number of programs in the channel . Methods: o Channel(String name, String language, int views, boolean live): constructor o addProgram(Program p): adds program p to the channel o getName(): returns the name of the channel o getLanguage(): returns the language of the channel o getViews(): returns the views of the channel o isLive(): returns whether the channel is live or not o calculateRating(): calculates the rating of the channel in the following way: Sports: views/matches * 2 News: (views / breaking) + ( audienceRating of all programs in the channel / segments) o display(): prints out the info of the channel and its programs Sports class: Attributes: o matches: the number of matches the channel covers Methods: o Sports(String name, String language, int views, boolean live, int matches): constructor o getMatches(): returns the number of matches in the channel News class: Attributes: o segments: the number of news segments in the channel o breaking: the number of breaking news the channel covers Methods: o News(String name, String language, int views, boolean live, int segments, int breaking): constructor o getBreaking(: returns the number of breaking news in the channel Group class: Attributes: o name: the name of the group Methods: O Group(String name, int size): constructor o addChannel(Channel c): adds channel c in the group if there's space and it's not already there o removeChannel(String name): removes the channel name if it exists and shifts the rest of the elements if needed o countLiveSports(String language, int matches): returns the number of sports channel that are live and in language with matches greater than or equal to matches o getNews(int breaking, double rating): returns an array of News channels having breaking news greater than breaking and rating at least rating Exercise 1: Translate into Java code all the previous classes. Exercise 2: Write a main method and test all previous functionalities
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
