PRO192_-_PE04_-_FA_2023_1303.webp
G

PRO192_-_PE04_-_FA_2023_1303.webp

-name:String
-duration: int
+Song()
+Song(name:String,duration:int)
+getName():String
+getDuration ():int
+toString():String
+compareTo(Object o):int
Song () - default constructor
Song(name:String, duration:int) - parameterized constructor, which sets values to name, and duration.
If the duration less than 1 then set to 1. The name in uppercase.
getName():String - return name
getDuration ():int - return duration.
toString():String - return the string format of the Song:name, duration
compareTo(Object o):int - sort the songs in ascending order by name
Write a class named SongList which extends from TreeSet (TreeSet is a collection) with the following information :
Where:
addSong(Song song): void - add a new song to the SongList
+addSong(Song song): void
+getSongMax Duration (): Song
+printSongList(): void
Zoom

getSongMaxDuration():Song song with the longest duration.return the
printSongList(): void - prints a list of songs in ascending order by name
Song List
+ 100%
Close
Chưa có bình luận nào.

Thông tin

Category
PRO192
Thêm bởi
graceful_beauty
Ngày thêm
Lượt xem
4,742
Lượt bình luận
0
Rating
0.00 star(s) 0 đánh giá

Image metadata

Filename
PRO192_-_PE04_-_FA_2023_1303.webp
File size
59.2 KB
Dimensions
1552px x 652px

Share this media

Back
Bên trên Bottom