• Tidak ada hasil yang ditemukan

King Saud University

N/A
N/A
Protected

Academic year: 2025

Membagikan "King Saud University"

Copied!
3
0
0

Teks penuh

(1)

King Saud University

College of Computer and Information Systems Department of Computer Science

CSC 113: Java Programming-II Lab: Polymorphism

+TV_Channel(in views : int, in live : Boolean) +getViews() : int

+isLive() : Boolean +display()

+calculateRating() : double TV_Channel -views : int

-live : Boolean

#nbProg : int

+Sports( in views : int, in live : Boolean, in nbMaches : int) +getNbMaches() : int

Sports -nbMaches : int

+News( in views : int, in live : Boolean, in newsSegmenst : int, in breakingNews : int) +getBreakingNews() : int

News -newsSegments : int

-breakingNews : int

+TV_Program(in audienceRate : double) +getAudienceRate() : double

+display()

TV_Program -audienceRate : double

#arProg

1 20

+TV_Group(in name : string) +add(in t vc : TV_Channel) +count LiveSport() : int +displaySport(in n : int)

+getChannels(in r : double) : TV_Channel [ ] +splitChannels(in t1 : TV_Channel [ ], in t2 : News [ ] )

TV_Group

-name : St ring -arTV

1 25

class TV_Program:

o Attributes:

ο‚· audienceRate: the audience rate of the TV program.

o Methods:

ο‚§ TV_Program (audienceRate: double): constructor

ο‚§ getAudienceRate(): this method returns the audience rate of the TV program.

ο‚§ display(): displays all attribute of the class

(2)

Class TV_Channel:

ο‚· Attributes:

o views : number of views of the channel.

o live: true if channel is live. False otherwise.

o nbProg: number of TV programs of the channel

ο‚· Methods:

o TV_Channel( views: int, live: boolean) : Constructor o getViews(): returns the number of views of the channel.

o isLive() : returns the value of the attribute live.

o display() : display all attribute of the class TV_Channel, Supports and News.

o CalculateRating() : this method calculates and returns the rating of the channel as follows:

TV_Channel: views *1.8 Sports : views / no. matchs *1.5 News: (views / breakingNews) +

βˆ‘audiance rate of all Tv programs of the channel / π‘›π‘’π‘šπ‘π‘’π‘Ÿ π‘œπ‘“ π‘π‘Ÿπ‘œπ‘”π‘Ÿπ‘Žπ‘šπ‘ 

Class Sports:

ο‚· Attributes:

o nbMatches : number of matches of the channel.

ο‚· Methods:

o Sports ( views: int, live: boolean, nbMatches: int) : Constructor o getNbMatches() : returns the number matches of the channel.

Class News:

ο‚· Attributes:

o newSegments: number of news segments of the channel.

o breakingNews : average occurrence of breaking news.

ο‚· Methods:

o News ( views: int, live: Boolean, newsSegments: int, breakingNews: int) : Constructor

o getNewsSegments () : returns the number of news segments of the channel.

o getBreakingNews () : average occurrence of breaking news.

Question 1: Translate into java class TV_Program, class TV_Channel , class News and class Sports.

(3)

+TV_Group(in name : string) +add(in tvc : TV_Channel) +countLiveSport() : int +displaySport(in n : int)

+getChannel s(in r : double) : TV_Channel [ ]

+splitChannels(in t1 : TV_Channel [ ], in t2 : News [ ]) TV_Group

-name : String

-arTV 1

25

+TV_Channel(in views : int, in live : Boolean) +getViews() : int

+isLive() : Boolean

+calculateRating() : double

TV_Channel -views : int

-live : Boolean

#nbProg : int

Class TV_Group:

ο‚· Attributes:

o name : name of the TV group.

ο‚· Methods:

o TV_Group (String name) : Constructor

o add(TV_Channel t) : adds the TV channel t to the TV group.

o countLiveSport(): this method counts and returns the number of Sports channels that are live.

o displaySport(n: int) : this method displays all the information of all Sports channels that have a number of matches greater than n.

o getChannels(r: double) : this method returns an array of TV channels having rating greater than r.

o splitChannels(t1: TV_Channel[], t2: News[]): this method splits the channels into two groups t1 and t2. t1 for Sports Channels having a number of matches greater than 20. t2 for News channels which number of views exceeds (is greater than) 3000.

Question 2: Translate into java code the class TV_Group.

Referensi

Dokumen terkait

Improving package structure of object-oriented software using multi-objective optimization and weighted class connections Amarjeet*, Jitender Kumar Chhabra Department of Computer

Values meanings are: P1= 0 1 meansPkt1 destined to output upper lower link,P1=1 meansPkt1 is idle Buffer.Size number of currently buffered packets TotBuff total number of input

Symbol Meaning St Total number of nodes/segments in thetth tree GaP;s Gain ratio of attributeain segmentsof perturbed dataset s A node affectedO;s Number of records in the

Hence, in this paper, some of the Arabic vowels attributes are investigated, analyzed and initial findings are presented based on tokens articulated by Malay speakers as we can consider

The technique is called artificial bee colony rate of change ABC-ROC because the scout bee process depends on the rate of change on the performance graph, replace the parameterlimit..

4/2/22, 7:35 PM Editorial Board - Journal of King Saud University - Engineering Sciences - Journal - Elsevier

SNB CAPITAL - KING SAUD UNIVERSITY WAQF FUND Managed by SNB Capital Company 5 CONDENSED STATEMENT OF CASH FLOWS For the six-month period ended 30 June 2022 Expressed in Saudi

Investment of The Fund’s Assets in Investment Fund Units Managed by The Fund Manager or Other Fund Managers The Fund may invest in units of other investment funds that comply with